Profile cover photo
Profile photo
Mordechai Danielov
Mordechai's posts

Post has attachment

Post has attachment

Post has attachment
MySQL performance - mystery no more

Post has attachment
parsing is like eating vegetables. Everyone knows it's good for you, but most prefer chocolate.

Post has attachment
got some convincing to do? Here is a method that may work

Post has attachment
this is how IT should be done

Post has attachment
dangerous tools can often be the best tools. Use it responsibly. :)

Post has attachment
Mordechai Danielov commented on a post on Blogger.
sometimes calling dm_exec_text_query_plan with DEFAULT,DEFAULT also returns a null. if you pass the offset values from dm_exec_query_stats, it should return a plan for that query (if not for the entire SP/Function)

use my_db
select * from (
select-- top 20 
, SUBSTRING(qt.text, (qs.statement_start_offset/2)+1,((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.text) ELSE qs.statement_end_offset  END - qs.statement_start_offset)/2) + 1) AS statement_text
,cast (tx.query_plan AS XML) [statement_plan]
from sys.dm_exec_query_stats (nolock) qs
CROSS APPLY sys.dm_exec_sql_text (qs.sql_handle) AS qt
OUTER APPLY sys.dm_exec_query_plan(qs.plan_handle) tp 
OUTER APPLY sys.dm_exec_text_query_plan(qs.plan_handle,qs.statement_start_offset,qs.statement_end_offset) tx
where 1=1
AND qt.dbid=db_id('my_db')
AND qt.objectid=object_id('my_sp')
--AND tp.query_plan is not NULL
--AND qs.execution_count>500
) TB
--WHERE statement_text like 'filter something%'
order by last_execution_time desc

Post has attachment
Mordechai Danielov commented on a post on Blogger.
thanks!! It would have taken me 20 years to figure this out.

Post has attachment
Wait while more posts are being loaded