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

sp_BlitzCache - Add Pattern column for @SortOrder = 'all' and include when outputting to table #3172

Closed
Adedba opened this issue Nov 16, 2022 · 4 comments

Comments

@Adedba
Copy link
Contributor

Adedba commented Nov 16, 2022

Is your feature request related to a problem? Please describe.
Would be good if sp_Blitzcache could show which sort order was used per result row when using @sortorder = 'all' especially for when you log this information to a table.

Currently if you query your BlitzCache output table you dont really know why a specific row is there, you could sort by various columns such as totalCPU etc however you may have a query/proc that has made it in the top 5 for a few different sort orders in which case getting the top 5 per CheckDate gets skewed.

Describe the solution you'd like
Have sp_BlitzCache return the Pattern column in the result set to show which sort order was used for the row
If this change is accepted I would like to revise sp_BlitzAnalysis to use this new column too.

Not sure if adding this new column for SortOrder = 'all' will break anything that relys on the current schema produced by sp_BlitzCache.

I have tested a revision with the following calls which succeed:

EXEC [dbo].[sp_BlitzFirst] 
	@OutputDatabaseName = 'DBA',
	@OutputSchemaName = 'dbo',
	@OutputTableName = 'BlitzFirst',
	@OutputTableNameFileStats = 'BlitzFirst_FileStats',
	@OutputTableNamePerfmonStats = 'BlitzFirst_PerfmonStats',
	@OutputTableNameWaitStats = 'BlitzFirst_WaitStats',
	@OutputTableNameBlitzCache = 'BlitzCache',
	@OutputTableNameBlitzWho = 'BlitzWho';
EXEC sp_BlitzCache
	@Top=5,
	@SortOrder= 'all', 
	@OutputDatabaseName = 'DBA',
	@OutputSchemaName = 'dbo',
	@OutputTableName = 'BlitzCache_test'

EXEC sp_BlitzCache @SortOrder = 'all'

Describe alternatives you've considered
No other solutions I can think of.

Are you ready to build the code for the feature?
You bet!

@Adedba Adedba self-assigned this Nov 16, 2022
Adedba added a commit to Adedba/SQL-Server-First-Responder-Kit that referenced this issue Nov 16, 2022
BrentOzarULTD#3172 - Add Pattern column for @sortorder = 'all'. First revision.
@Adedba
Copy link
Contributor Author

Adedba commented Nov 16, 2022

Made a first revision for testing.

@BrentOzar
Copy link
Member

@Adedba I haven't heard back from you, so I'll go ahead and close this for now, but if you decide you want to work on it, you can leave a comment here when you're ready to do a pull request, and I can reopen it.

@Adedba
Copy link
Contributor Author

Adedba commented Jan 25, 2023

Thanks Brent, I have created a pull request now.

@BrentOzar BrentOzar added this to the 2023-01 Release milestone Jan 31, 2023
@BrentOzar
Copy link
Member

Thanks for the pull request! Looks good, merging into the dev branch. Will be in the next release with credit to you in the release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants