arthurhsu / lovefield-ts

Lovefield TypeScript port: successor of google/lovefield
Apache License 2.0
47 stars 3 forks source link

Optimize SELECT LIMIT SKIP query without ORDER BY #27

Open arthurhsu opened 1 year ago

arthurhsu commented 1 year ago

Currently the LimitSkipByIndexPass will look for an existing IndexRangeScanStep in the execution tree

For this query, because there is no predicate, an IndexRangeScanStep does not exist in the tree, but instead of concluding that the optimization is not applicable, we should check if the table has a primary key. If it does, then use the primary key's index to perform LIMIT/SKIP.