Subject wrong row count with large SELECT
Author davidrushby
I'm using the C API function isc_dsql_sql_info with the request code
isc_info_sql_records to determine the row count from a SELECT
statement on a table (a plain table, not a selectable stored proc or a
view).

Ordinarily, the row count is 0 from the time the SELECT statement is
executed until at least 1 fetch has been performed, then the real row
count can be determined. This is expected.

With large result sets, however, the row count is misreported. The
threshold on both FB 1.0 and FB 1.5-RC2 is 1302 rows; any SELECT that
returns more than 1302 rows but less than 2605 rows has the row count
misreported as 1302 until at least 1303 rows have been fetched, at
which point the row count is reported correctly again. The next
threshold after 1302 is 2604, then 3906, 5208, ...

Because of that pattern, I'm assuming that result sets are marshalled
within the server in batches no larger than 1302 rows at a time; until
a batch has been marshalled, its contents are not included in the row
count returned by isc_dsql_sql_info. Is my assumption correct?