Subject Re: Maximum number of rows in Firebird 2.1 and up (is it 1099511627776 records ?) lmatusz 2011-04-17T22:09:03Z
--- In firebird-support@yahoogroups.com, Ann Harrison <aharrison@...> wrote:

> <dpg> is a data page. <ppg> is a pointer page. The record
> number space limited this way:
>
> <max records on dpg> * <max dpg per ppg> * <max ppg> < 2**40
>
> The middle factor, data pages per pointer page, is determined by the
> page size, so the highest possible number of pointer pages per table
> depends on how many records you assume you could possibly have
> on a data page.

1)

<max dpg per ppg> = (database_page_size - ppg_header) / 4.25

struct pointer_page
{
SLONG ppg_sequence;
SLONG ppg_next;
USHORT ppg_count;
USHORT ppg_relation;
USHORT ppg_min_space;
USHORT ppg_max_space;
SLONG ppg_page[1]; (4 in equation above)
};
...Page fill bitmaps: At the end of each pointer page is a bitmap array of two bit entries which is indexed by the same index as the ppg_page array. (2/8 of bits = 0.25 in equation above)

2)

<max records on dpg> = (database_page_size - dpg_header) / (record_size+4)

struct data_page
{
pag dpg_header; // 16 bytes long
SLONG dpg_sequence;
USHORT dpg_relation;
USHORT dpg_count;
struct dpg_repeat {
USHORT dpg_offset; // 2 bytes +
USHORT dpg_length; // 2 bytes = 4 bytes in equation above
} dpg_rpt[1];
};

3)

How to compute <max ppg> ?
Are these equations are correct ?

Sorry for bothering... but i would like mathematical equation for max number of rows/records.

As a matter of curiosity in FirebirdSQL sources they state that practical table size limit (not counting allocation threshold and overhead) roughly equal to:

16k page = 20,000 GB
8k page = 100,000 GB
4k page = 2,500 GB
2k page = 600 GB
1k page = 150 GB