May 10, 2019 at 12:55 pm
Is there any way to calculate the hash for the query which will the same as calculated by the engine?
May 10, 2019 at 1:30 pm
Which hash are you referring to?
Which tool are you wanting to calculate the hash with?
Which engine are you referring to? The Mazda I have at the moment is pretty fast, but its engine is rubbish with hashes.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
May 10, 2019 at 1:41 pm
I don't think you can because the hash is created internally based on a structure in the optimizer, not the T-SQL text, that would also have to be recreated. You could probably run the debugger to figure all this out. What do you need it for?
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 10, 2019 at 1:48 pm
I don't think you can because the hash is created internally based on a structure in the optimizer, not the T-SQL text, that would also have to be recreated. You could probably run the debugger to figure all this out. What do you need it for?
Ah, that hash. I was thinking that the OP was referring to something like HASHBYTES or CHECKSUM.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
May 10, 2019 at 2:58 pm
Really curious what the use case and need is though.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 10, 2019 at 3:36 pm
Grant,
I have EF Core interceptor created for my app. I want to calculate such hash value for the query being executeted. Next I want to match this hash to the hash stored in DMV views.
May 10, 2019 at 3:55 pm
Ah, interesting use of the tools. Unfortunately, I don't know of a way to do it. I'm not saying it can't be done, just that there's not a way I'm aware of.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 10, 2019 at 4:55 pm
Thank you Grant for your reply.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply