Subject Re: Maximum number of rows in Firebird 2.1 and up (is it 1099511627776 records ?)
Author lmatusz
--- In firebird-support@yahoogroups.com, "lmatusz" <matuszewski.lukasz@...> wrote:
>
>
> --- In firebird-support@yahoogroups.com, "lmatusz"
> <matuszewski.lukasz@> wrote:
> >
> >
> > --- In firebird-support@yahoogroups.com, "hvlad" hvlad@ wrote:
> > >
> > > > i would like mathematical equation for max number of rows/records.
> > >
> > > Read PAG_init() function in \src\jrd\pag.cpp
> > >
> > > Regards,
> > > Vlad
> > >
> > In src/jrd/RecordNumber.h you are stating that practical table size
> > limit is roughly equal to:
> > db_page_size table_size_without_allocation_threshold_and_overhead
> > 16kB 20000 GB
> > 8kB 10000 GB
> > 4kB 2500 GB
> > , but giving the maximum records per table (which i believe is not
> > dependent on db_page_size) i have following
> > table_size_without_allocation_threshold_and_overhead:
> > record_size table_size_without_allocation_threshold_and_overhead
> > 10 6447 GB
> > 100 14878 GB
> > 200 16044 GB
> > 1024 17123 GB,
> > and i think it doesn't dependent on db_page_size as it is stated in
> > src/jrd/RecordNumber.h.
> > Where is the truth ? I would like to hear about it from Vlad Khorsun
> > (hvlad).
> >

In src/jrd/RecordNumber.h in checkNumber() you state also that record number is:

value < QUADCONST(0x10000000000) &&
value < (SINT64) MAX_USHORT * records_per_page * data_pages_per_pointer_page;

MAX_USHORT=65535

records_per_page=(-21+square_root(21^2+4*comp_rec_size*db_page_size)/(2*comp_rec_size)

data_pages_per_pointer_page = (-32 + square_root(32^2 + 4*(8*db_page_size-256)))/64

BUT THIS FUNCTION IS NEVER USED :)

Here are final caluculations:

http://cid-28c38c52c8760273.office.live.com/embedicon.aspx/.Public/!MaxRecordsPerDatabase4.xls

or here

http://cid-28c38c52c8760273.office.live.com/embedicon.aspx/.Public/!MaxRecordsPerDatabase4.ods

(the sizes of max table size are just like stated in src/jrd/RecordNumber.h).