LIMIT not working with Linked Tables?

36 views
Skip to first unread message

neive

unread,
Aug 5, 2025, 1:06:02 PMAug 5
to H2 Database

Hi all,

I'm using H2 2.2.224 and noticed that when querying a linked table like this:

sql
SELECT id FROM tbl WHERE createdAt > '2024-04-01' LIMIT 100;

it fetches all rows from the remote DB, and only then applies the limit.
EXPLAIN ANALYZE shows reads: matching total row count, and it's very slow.

From the code, it looks like LinkedIndex.find() doesn’t include LIMIT when generating the SQL sent to the remote DB.
https://github.com/h2database/h2database/blob/master/h2/src/main/org/h2/index/LinkedIndex.java#L90-L110

Is this expected? Or is LIMIT just not supported yet in linked table queries?

Thanks!

Reply all
Reply to author
Forward
0 new messages