Hello.

Try using a "WHERE" clause if possible.
Ex: WHERE "some_date_column_of_the_table" > (current_date - n)

Atenciosamente,

+ + Hugo Eyng + +

________________________________
De: firebird-support@yahoogroups.com <firebird-support@yahoogroups.com> em nome 
de Matthias Winkler spmm...@gmail.com [firebird-support] 
<firebird-support@yahoogroups.com>
Enviado: terça-feira, 4 de fevereiro de 2020 11:36
Para: firebird-support@yahoogroups.com <firebird-support@yahoogroups.com>
Assunto: [firebird-support] Bad performance with select first(1) + order by



Hello,

I am struggling with my DB performance once more:

   SELECT FIRST(1) PRIMKEY
   FROM TABLE_X
   ORDER BY PRIMKEY DESC

The statement is slow once more because of the sorting.
I just want to find the entry with the highest primary key.
The PRIMKEY is ASC and unique.

Is the another way to achieve the same?

Thanks

Matthias



  • [firebi... Matthias Winkler spmm...@gmail.com [firebird-support]
    • Re... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
    • Re... Svein Erling Tysvær setys...@gmail.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]
              • ... Matthias Winkler spmm...@gmail.com [firebird-support]
                • ... Matthias Winkler spmm...@gmail.com [firebird-support]
                • ... 'Mathias Pannier (unitel)' pann...@ubsysteme.de [firebird-support]
    • RE... Hugo Eyng hugoe...@msn.com [firebird-support]

Reply via email to