Provide a pattern to explicitly name sql queries displayed in databases dashboard
- I would like to request a way to name the queries displayed in the databases dashboard for which the queries are grouped by.
Currently most of my queries show in one of three formats.
- MSSQL getPerson ExecuteProcedure //Stored procedure
- MSSQL photo select // Raw sql query
- MSSQL today declare // Raw sql query declaring a variable at the top
On the third one we are running into a few situation where we declare a variable at the top of our raw sql query similar to
declare @today date = getdate(); which is causing it to be the name of the query. With the 2nd and 3rd example we find it’s grouping unrelated queries together for which we would prefer them to be separate since they will usually average each other out and make it harder to identify the specific problem queries especially if the request is not slow enough to cause a trace.
Stored procedures work great in this situation but with additional versioning overhead and deployment complexity which is not preferred.
One solution which should work would be named variables at the top of each raw query for the sole purpose of naming the query. This feels very hacky since it would actually be parsed and executed by sql.
My preference would be the ability to add a comment at the top of the raw query. We have started doing this already so our queries are named when running database traces and so they show in the query details screen of newrelic which works great as is A+. It’s really just the naming and grouping that is the problem.
We would be willing to change the format of our comments if that means it would be used as the query name. For example
NR: My Query 1 or
MSSQL: My Query 1 some specific tag or format so NewRelic knows we are explicitly naming this query. It would also not affect existing customers which have sql comments for unrelated reasons.
NewRelic is already parsing the query text to extract the names. It seems parsing out this name would be relatively straight forward if a specific pattern could be established to opt in and avoid false positives.
I did not find any other request for this feature in the dotnet agent but did find similar requests for the Java and PHP agents.
New Relic Edit
- I want this too
- I have more info to share (reply below)
- I have a solution for this
We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.