Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parked: fix(sqlite): Reduce expand materialization for SQLite #557

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BobdenOs
Copy link
Contributor

When processing queries that have ORDER BY or HAVING clauses. SQLite materializes the whole result before applying them. Which has to happen before LIMIT and OFFSET can be applied. Therefor moving the expand expression out of the native query prevents them from being materialized.

When applying the same approach to Postgres there is no change in performance. Indicating that Postgres is able to identify what is required to be materialized and what can be materialized after reducing the result set.

An impacted query was found in the sflight example application:

-- before
 95.92 → 108.79 =  12.88 ms - better-sqlite3 - SELECT json(jsonb_insert('{}','$."BeginDate"',BeginDate,'$."Book ...

--- after
 76.72 → 78.70  =   1.98 ms - better-sqlite3 - SELECT json(jsonb_insert('{}','$."BeginDate"',BeginDate,'$."Book ...

@BobdenOs BobdenOs enabled auto-merge (squash) May 29, 2024 16:02
@BobdenOs BobdenOs disabled auto-merge May 29, 2024 16:02
@BobdenOs BobdenOs added the next release pr to be checked for next release label Jun 7, 2024
@johannes-vogel johannes-vogel changed the title fix(sqlite): Reduce expand materialization for SQLite parked: fix(sqlite): Reduce expand materialization for SQLite Sep 2, 2024
@johannes-vogel johannes-vogel removed the next release pr to be checked for next release label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants