Subject Limiting fetched rows doesn't offer much performance benefit
Author jimbehr3446
We are trying to query a very large table (millions of records) and
only retrieve a few rows using "FIRST n". From our tests, "SELECT
FIRST 50 * FROM TABLE WHERE FLAG='Y'" doesn't run significantly faster
than "SELECT * FROM TABLE WHERE FLAG='Y'". The FLAG field is combined
in a compound index with a unique record number to avoid low selectivity.

A review of previous postings appears to be contradictory. Several
newsgroup postings indicate "FIRST n" doesn't make sense without an
ordering clause. One newsgroup posting,
news://news.atkin.com:119/43F0AC95.6090402@..., stated "If
you don't include an order by, then the first x records are returned
and the query stops" which is the behavior we would like but have not
observed.

We are not using an ordering clause since we do not care what order
the records are in. We are trying to locate records that have been
queued up for processing. Does anyone know of a way to retrieve a few
records without the query going through the entire table?

We are using FB 1.5.3.4842 on Windows.

Thanks in advance for any assistance.