fix(oracle): use bind parameters in showIndex - #18498
Draft
wikirik-agent wants to merge 1 commit into
Draft
wikirik-agent wants to merge 1 commit into
wikirik-agent wants to merge 1 commit into
Conversation
Oracle hard parses every distinct SQL text. Because the table name was inlined, every showIndex call (which Model.sync runs for each model) was hard parsed against the dictionary views, which takes hundreds of milliseconds on Oracle 23. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Sep 26, 2026
wikirik-agent
added this pull request to stack #18500
September 26, 2026 06:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Model.sync()runsqueryInterface.showIndex()for every model. On Oracle, that query inlined the table name as a literal, so every call was a new SQL text that Oracle had to hard parse against theALL_IND_COLUMNS/ALL_INDEXES/ALL_CONSTRAINTSdictionary views. On Oracle 23 that parse takes hundreds of milliseconds.This PR makes the Oracle query interface run
showIndexwith the table and schema names as bind parameters, so Oracle reuses the parsed statement across tables:OracleQueryGenerator#showIndexesQueryWithBind()returns{ query, bind }and shares its SQL withshowIndexesQuery().showIndexesQuery()still returns the same SQL with literals, so its output does not change.OracleQueryInterface#showIndex()uses the bind variant.Local numbers against a fresh
gvenzl/oracle-free:23.26.3-slimcontainer, the same image CI uses:showIndexcall, new table name each time (micro-benchmark)showIndextotal time intest/integration/associations/**(650 calls)test/integration/associations/**total (276 tests; with #18497 applied as well)Hard parsing accounted for about 56% of all SQL time in the Oracle integration suite. That is the main reason the "oracle latest" CI job (~15 min) is the slowest one; "oracle oldest" (18 XE) runs the same tests in ~6 min. #18496 is a CI-only experiment that forces cursor sharing to measure the same effect.
showConstraints(the foreign-key lookup) anddescribeTableinline literals the same way. They are handled in the stacked follow-up #18499, which needs a small core seam because the abstract query interface post-processes their results.List of Breaking Changes
None.
🤖 Generated with Claude Code