Hi

      „select first(8) ID from TBL_TEST
      where ID not in (select first(2) ID from TBL_TEST order by ID desc)
      order by ID desc”

few things:

Just hint but „first” is not function First(8) is same as First 8  😉

You should avoid NOT IN queries and use EXISTS/NOT EXISTS instead.
But if you really need it then such subquery should be well indexed.

>> „Is there a way to force limiting the result set before sorting it?”

Create descending index on ID column, than this subquery will go throught index 
without sorting.

It will be instant i suppose

Regards,
Karol Bieniaszewski

  • Re: [fi... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
    • Re... Matthias Winkler spmm...@gmail.com [firebird-support]
      • ... Gabor Boros mlngl...@bgss.hu [firebird-support]
      • ... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
        • ... Matthias Winkler spmm...@gmail.com [firebird-support]
          • ... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
            • ... Matthias Winkler spmm...@gmail.com [firebird-support]
              • ... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
        • ... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
          • ... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
            • ... Karol Bieniaszewski liviusliv...@poczta.onet.pl [firebird-support]
              • ... Matthias Winkler spmm...@gmail.com [firebird-support]
              • ... setysvar setys...@gmail.com [firebird-support]
              • ... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
              • ... Matthias Winkler spmm...@gmail.com [firebird-support]
  • Re: [fi... Elmar Haneke el...@haneke.de [firebird-support]

Reply via email to