Skip to content

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>
@zzak zzak requested a review from byroot July 3, 2023 08:00
@byroot byroot merged commit d086692 into rails:main Jul 3, 2023
@zzak zzak deleted the re-48398 branch July 3, 2023 10:41
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