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

EXPLAIN; pg-sql2 enhancements; pgSelect/pgUnionAll query overhaul; JIT tweaks #270

Merged
merged 23 commits into from
Apr 11, 2023

Conversation

benjie
Copy link
Member

@benjie benjie commented Apr 7, 2023

  • Add EXPLAIN support, including EXPLAIN ANALYZE (TODO: make this configurable from Ruru!)
  • Fix accidental SQL trimming in Ruru
  • pg-sql2 now uses the same placeholder for the same sql.value node (i.e. $1 ... $1 rather than $1 ... $2)
  • Completely refactor how pgSelect/pgUnionAll builds the SQL queries, and how PgExecutor executes them
    • no more queryValuesSymbol hack - instead we just push to an array
    • now we have two queries: one for when there's only one "pending" (faster) and one where there's more than one
  • Replace set jit = 'off' with set jit_optimize_above_cost = -1
    • it turns out that the JIT can significantly help in the case of unindexed queries, with it turned off some queries were 20+% slower than in V4 purely due to JIT differences.
  • pg-sql2 now makes symbolToIdentifier available to consumers

benjie added 23 commits April 6, 2023 18:22
…lping PostgreSQL to optimize queries that have a batch size of 1.
…other operations) support added. Currently requires `DEBUG="datasource:pg:PgExecutor:explain"` to be set. Publish this through all the way to Ruru.
… places, it will now be replaced with the same placeholder (`$1`, etc).
…ifier` on `sql.compile()` result so you can determine which identifiers were used for which symbols.
…ove_cost = -1` so that JIT can still be used but heavy optimization costs are not incurred.
@benjie benjie merged commit fb7dd23 into planning Apr 11, 2023
@benjie benjie deleted the rewrite-query-behavior branch April 11, 2023 08:32
@benjie benjie added this to the V5 alpha milestone Apr 13, 2023
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.

1 participant