Einzelnen Beitrag anzeigen

Robert_G
(Gast)

n/a Beiträge
 
#5

Re: InterBase-SQL ,SELECT -Anweisung

  Alt 26. Feb 2004, 13:37
@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
  Mit Zitat antworten Zitat