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

Parameter substitution increases plan cache bloat #163

Open
tivivi63 opened this issue Oct 8, 2024 · 2 comments
Open

Parameter substitution increases plan cache bloat #163

tivivi63 opened this issue Oct 8, 2024 · 2 comments

Comments

@tivivi63
Copy link

tivivi63 commented Oct 8, 2024

SQLQueryStress is a great tool, really. But I noticed that generating fake parameter values from a query tends to create multiple plan cache entries for the same exact command text, when it comes to nvarchar command parameter types (that is obviously not a problem with integer-types parameters).

The risk here is to bloat plan cache when param substitution query return a ton of different-length values. In my example, "random" parameter generator consists in querying a name from a users table and this created 14 different plans with the same statement, mapping name length occurrence natural distribution to execution count.
image

In the UI, I can't see any way to customise inferred-from-query parameter type, automatically set to nvarchar where expected type is nvarchar(32) :
image

Any idea how to work around this situation?
Thanks,

@ErikEJ
Copy link
Owner

ErikEJ commented Oct 9, 2024

So if you had a option to choose nvarchar(50) that would work for you?

@tivivi63
Copy link
Author

For my current needs, nvarchar(50) shall fit indeed, but this is not a global solution.

Actually, my favorite option would be to allow specifying (or not) a free-text length as a new column in the Parameter mappings grid, with voided default value, even if I know it is harder to complete 🥴 But that should cover every future need.

Thanks for the work done,

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

No branches or pull requests

2 participants