Hello.

It looks like all or almost all rows in your table match the WHERE criteria 
and database must return all of them, that's why scan count is so large.

If you read only the first row you need to do two things.

1. Create an index that can be used to read rows in the same order as it 
specified in ORDER BY clause. Without such index database must read all 
matched rows and sort them.
CREATE INDEX SOME_INDEX_NAME ON TRANSAKCJA(DATA DESC, ID DESC)
Note that DESC order should be specified for index too, otherwise it will 
not be used.

2. Limit number of returned rows. Add
FETCH FIRST ROW ONLY
at the end of your query.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to