Subject Re: Above 60 G (60*1000*1000*1000) records per table for 50 byte compressed record
Author lmatusz
--- In firebird-support@yahoogroups.com, Ann Harrison <aharrison@...> wrote:
>
> On Mon, Apr 25, 2011 at 3:59 AM, lmatusz <matuszewski.lukasz@...> wrote:
>
> Stuff about blob-ids is deleted because I don't know whether that's changed
> and don't remember how it worked.
>
> > There is a decompose function which gives us line, slot and pp_sequence:
> >
> > line = static_cast<SSHORT>(value % records_per_page);
> > const ULONG sequence = static_cast<ULONG>(value / records_per_page);
> > slot = sequence % data_pages_per_pointer_page;
> > pp_sequence = sequence / data_pages_per_pointer_page;
> >
> > What is slot and line (pp_sequence is as i assume a pointer page number) ?
> >
> > Does slot is a pointer_page::ppg_page index ?
> > Does line is a data_page::dpg_rpt index ?
>
>
> Yes to both. The slot is the offset on the pointer page that holds the
> number of the data page and the line is the offset into the offset/length
> index on the data page that describes the record.
>
> Good luck,
>
>
> Ann
>

Thanks a lot - a really appreciate your answers.
Blob id is i believe another record number (must be divided into pp_sequence, slot and line).

Blobs can be stored in up to three levels.
Level 0 blobs contain the blob data. In that case, the bytes following
the blob header are actual data, complete with the length words we
talked about earlier. Level 1 blobs are arrays of page numbers of level
0 blob pages. Level 2 blobs are arrays of page numbers of level 1
blobs.

Level 2 blobs are (I think) always stored on data pages. Level 1 blobs
are stored on data pages if they fit and if not, the engine creates a
level 2 blob and puts that on a data page and puts the level 1 blobs on
blob pages.

Let me see if I can be more clear. All blobs have some level 0 data.
That may be on a data page (if it fits), or on one or more blob pages.
If the level 0 blob is stored on blob pages, then there is a level 1
blob that contains an array of the page numbers for the blob. The level
1 blob is also stored on a data page unless it is to large to fit. If
it is too large, then there is a level 2 blob that contains an array of
the page numbers of the level 1 blob pages.

The blob id stored in the record has the same format as a db_key. It
decomposes into a relation id, a pointer page sequence number, an offset
on the pointer page which contains the number of the data page, and an
index on the data page.
So the record MUST point to something on a data page.

if (blob->blh_level == 0)
{
char * p = ((char *) page + index->dpg_offset) + sizeof (struct (blh)-4);
char * end = ((char *) page + index->dpg_offset) + index->dpg_length;
// read from p to end.
}

Thanks again
Ɓukasz Matuszewski

http://lmatusz.blogspot.com