Skip to content

Disable database prepared statements when query logs are enabled#48631

Merged
byroot merged 1 commit intorails:mainfrom
zzak:re-48398
Jul 3, 2023
Merged

Disable database prepared statements when query logs are enabled#48631
byroot merged 1 commit intorails:mainfrom
zzak:re-48398

Conversation

@zzak
Copy link
Member

@zzak zzak commented Jul 3, 2023

Fixes #48398

Prepared Statements and Query Logs are incompatible features due to query logs making every query unique.

Marginalia explains the situation pretty well:

Be careful when using Marginalia with prepared statements. If you use a component like request_id then every query will be unique and so ActiveRecord will create a new prepared statement for each potentially exhausting system resources. Disable prepared statements if you wish to use components with high cardinality values.

Fixes rails#48398

Prepared Statements and Query Logs are incompatible features due to query logs making every query unique.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should Active Record disable prepared statements if QueryLogs are enabled?

2 participants