Assume: col1 has clustered index defined on it via a PK constraint. I have a weird case where col2 with a NCI on it performs worse than when col2 has a NCI and INCLUDES col1. I thought the include was kind of implicit due to the NCI built on the CI. details appreciated! #sqlhelp
@Hugo_Kornelis Hugo TYVM. The confusing part in my case is that all NCIs have a pointer to the CI (its baked into NCIs). So why, if the NCI knows to which row in the CI it points did an INCLUDE of the column (that IS that pointer) speed up the query? It shouldbhave made NO difference
@Hugo_Kornelis I dont hugo. But its pretty simple. Pk on col1, then run Select col1, col2 from table1 where col2 = 0. Build an index1 on col2. And the select will use the index. build index2 on col2 INCLUDE col1 and Rerun the select. You will see rhe ExePlan choses the index2...why?
Can i easly set up an ee session to capture DML? All i want to do is capture and store before and after values of DML. Yes i know i can use triggers, yes i know i can use CDC. Im pouring over all of my options and figured id ask the expert(s)... #sqlhelp@erinstellato
@jdanton@erinstellato@mrdenny In rereading my post i realize i refered to two different phenominoms. I wish to capture data values not sql statements. Thanks Joey and Denny for the followup.
@erinstellato@jdanton@mrdenny Erin you are a rocker! Thanks for directly answering my question! And thanks to this community for chiming in. After a full day of researching i too found no way for exented events to capture a before and after value of an update!
I have idle blockers running amok in prod. ill get one “random” session go idle and that will start a nasty blocking chain. Does anyone have good systemic ways to root cause why the spid/transaction went idle in the first place!? Thanks all! #sqlhelp.
@PaulRandal Dpa defines an idle blocker as one that WAS doing work but is not currently. Often times from an mis managed trans. So i have a spid and a time point and i know its blocking locker. Another road i could go down is “how do you find the last wait a spid had?” Thanks!