Why can't you select MAX(ID) and no ORDER BY, instead of fetching the first row of ordered select?
SELECT MAX(id) FROM TRANSAKCJA WHERE "DATA" <= '2019-01-18 00:00:00.0' -- 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 h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.