Subject Re: [ib-support] Big slow select query from multiple tables
Author Ann Harrison
At 08:14 PM 6/7/2002 +0100, Stevio wrote:
>How does NATURAL work, or what does it do?

All records are stored on data pages. The database
is made up of pages, all the same size, but of different
types. Generators are stored on generator pages,
transaction states on transaction pages, index nodes
in index pages, etc. For every table there are records
in a system table called "RDB$PAGES". Each of those
records contains the page number of a page of page numbers
(aka a pointer page) of data pages for the table.

A natural scan reads RDB$PAGES to locate all the pointer
pages for the target table. It then opens the first pointer
page and reads all its data pages, then goes on to the next
pointer page and so on to the end of the table.

The data is returned in no particular order. If there have
been no deletions, it will appear in storage order. If
records have been deleted and replaced, the order with be
generally storage, with new records scattered around taking
up unused spaces.

Regards,

Ann