Subject | RE: [firebird-support] The First to select |
---|---|
Author | Alan McDonald |
Post date | 2006-02-13T04:07:37Z |
>Helen has always said that the latter is the true state, i.e. a full scan is
> Hi guys,
> I'm wondering if anyone out there knows the inside workings of the
> select FIRST(x) mechanism.
> My question is, In a complex select First query with inner joined
> tables, does firebird do the required calculation and comparing to
> attain the first X num of records, then stop executing and return the
> results OR does the required calculation and comparing for ALL records
> but only returns the first X??
> Any answers or comments are highly appreciated!!
>
performed before an order by clause starts filtering the return set but in
my use of the FIRST clause even using Selectable SPs, I experience such an
improved performance when comapred with any other full scan query that I
suspect the former is in fact the true state.
just a simple test of a very large table will prove the point to your self.
SELECT FIRST 10 SKIP 1000000 from table order by PK is very fast an does not
indicate that the server is getting bogged down on running thru a million
records before starting to return the 10 records
I stand corrected of course, but I'm very happy with FIRST performance.
Alan