@Leuselator
Man sollte für eine solche Einschränkungen neien StopKey verwenden (bei mir RowNum...)
Da bei deiner Variante ein zweiter kompletter Table
access nötig war:
SQL-Code:
SELECT *
FROM XXXXXXXXX.sent_queries t
WHERE t.error_id >= 3000 And
RowNum = 1
Optimizer plan:
Delphi-Quellcode:
SELECT STATEMENT, GOAL = CHOOSE CHOOSE SELECT STATEMENT
COUNT STOPKEY STOPKEY COUNT
TABLE
ACCESS FULL XXXXXXXXX SENT_QUERIES FULL TABLE
ACCESS
SQL-Code:
SELECT *
FROM XXXXXXXXX.sent_queries t
WHERE t.error_id = (SELECT Min(sq.error_id)
FROM XXXXXXXXX.sent_queries sq
WHERE sq.error_id >= 3000)
Optimizer plan:
Delphi-Quellcode:
SELECT STATEMENT, GOAL = CHOOSE CHOOSE SELECT STATEMENT
FILTER FILTER
TABLE
ACCESS FULL XXXXXXXXX SENT_QUERIES FULL TABLE
ACCESS
SORT AGGREGATE AGGREGATE SORT
TABLE
ACCESS FULL XXXXXXXXX SENT_QUERIES FULL TABLE
ACCESS