SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Extended Events captures query_hash/query_plan_hash to 0 in some queries


Extended Events captures query_hash/query_plan_hash to 0 in some queries

Author
Message
i1888
i1888
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1513 Visits: 574

Extended Events captures query_hash/query_plan_hash to 0 in dynamic query sometimes, anyone knows why? thanks!

XE:

CREATE EVENT SESSION [XE_CPUUsage] ON SERVER
ADD EVENT sqlserver.sql_statement_completed(SET collect_statement=(1)
ACTION(package0.collect_system_time,sqlos.task_time,sqlserver.client_app_name,sqlserver.database_name,sqlserver.query_hash,sqlserver.query_plan_hash,sqlserver.server_instance_name,sqlserver.server_principal_name,sqlserver.sql_text)
WHERE ([cpu_time]>=(500000)))
ADD TARGET package0.event_file(SET filename=N'c:\temp\XEventSessions\XE_CPUUsage.xel',max_file_size=(65536),max_rollover_files=(5))
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=5 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=ON)
GO

Screenshot:


GilaMonster
GilaMonster
SSC Guru
SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)

Group: General Forum Members
Points: 903792 Visits: 48757
It's an EXEC statement. The only things that have query hashes are the queries themselves, not exec of stored procedures (which this is)

Since you're capturing statement completed, you should have another event with the INSERT <obscured table name> alone, outside of the EXEC.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


i1888
i1888
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1513 Visits: 574
GilaMonster - Tuesday, January 2, 2018 3:27 AM
It's an EXEC statement. The only things that have query hashes are the queries themselves, not exec of stored procedures (which this is)

Since you're capturing statement completed, you should have another event with the INSERT <obscured table name> alone, outside of the EXEC.

I have converted/translated/imported the extended events file to a table in sql server.
I found those "exec ***" statement only has its own record in extended event, there is no other query/statement which is in the "exec [query part]"

GilaMonster
GilaMonster
SSC Guru
SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)

Group: General Forum Members
Points: 903792 Visits: 48757
Try adding sp_statement_completed event.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


GilaMonster
GilaMonster
SSC Guru
SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)SSC Guru (903K reputation)

Group: General Forum Members
Points: 903792 Visits: 48757


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


i1888
i1888
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1513 Visits: 574
Thanks!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search