-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Optimization: statements reuse previous column name #1711
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThis set of changes modifies how column metadata is managed and benchmarked in the codebase. The Changes
Sequence Diagram(s)sequenceDiagram
participant Benchmark
participant DB
participant readColumns
Benchmark->>DB: Prepare statement
Note right of Benchmark: Timer/allocs not started
Benchmark->>Benchmark: b.ReportAllocs(), b.ResetTimer()
loop N times
Benchmark->>DB: Execute query
DB->>readColumns: readColumns(count, old)
readColumns-->>DB: Columns metadata (possibly reused)
DB-->>Benchmark: Scan result
end
sequenceDiagram
participant DB
participant readColumns
DB->>readColumns: readColumns(count, oldColumns)
alt oldColumns matches
readColumns->>readColumns: Reuse string references for tableName and name
else oldColumns mismatch
readColumns->>readColumns: Allocate new strings
end
readColumns-->>DB: Columns metadata
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
⏰ Context from checks skipped due to timeout of 90000ms (20)
🔇 Additional comments (8)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Description
#1708 added
[]mysqlField
cache to stmt. It was used only for MariaDB cached metadata.This commit allows MySQL to also benefit from the metadata cache. If the column names are the same as the cached metadata, it reuses them instead of allocating new strings.
Checklist
Summary by CodeRabbit