last day (690 days later) » 

does it work?
 
Worx
 
Welcome!
Sean?
 
I will try to be a good host
so I have four queries that look at the same set of heaps
the run times can be pretty different, but that's expected
they do different things
 
11:06 PM
QQ: How long do you wait for your manager to call you before you leave the bridge line?
I just assume I'm fired
 
I solve that problem by never going on bridge lines
good, then you don't have anything better to do
if the data for the tables is already in the buffer pool then the worker times for the queries might look something like this:
 
ok 4 queries, terrible heaps
 
266425009
62749303
178205126
1368151389
 
so far to terrible
 
so between 266 s and 1368 s of CPU time
all queries run in MAXDOP 8
in a test with nothing in the buffer pool
the worker times looked like this:
 
11:08 PM
Are we only look at worker time?
 
2073369708
2183190039
2125960772
2335283420
@SeanGallardy-Microsoft what else would you like?
 
Nothing, just asking
 
I think that it illustrates the point well, but if I'm being dumb let me know
so those worker times are way too high and way too consistent
 
well it's a cold BP...
 
We looked at perfmon and real CPU usage wasn't even close. Also, three of the queries finished at the same second
 
11:10 PM
Does this only happen if the BP is cold?
 
yes
 
Alright, my next question
Have you looked at the individual wait stats per query, hot vs cold?
Not server wide, individual query
@sp
@sp_BlitzErik There's an XE for that ;)
 
@SeanGallardy-Microsoft I can share an xe script I put together for that when I get home
 
I'm familiar with what the wait stats should look like for these queries
for the hot queries, the CPU to elapsed time is pretty close to 8
7.73, 7.97, 7.79, etc
so I don't expect to find anything in wait stats for the hot queries. reasonable assumption?
 
It may be a reasonable assumption but it's still nice to know the differences, but let's assume there are little
 
11:15 PM
I can get you server level for the cold and hot
but not on sql server 2017, so query level isn't the easiest thing to do
can see what sys.dm_exec_session_wait_stats says
by server level, I mean the delta while the queries run. that's what you're after, right?
 
@JoeObbish No, I need fine grained information
Give me a second
I thought the tiget team had something already done
but I ca'nt find it so I'll steal Pauls
CREATE EVENT SESSION MonitorWaits ON SERVER
ADD EVENT sqlos.wait_info
(WHERE sqlserver.session_id = 53 /* session_id of query */)
ADD TARGET package0.asynchronous_file_target
(SET FILENAME = N'C:\folder\WaitStats.xel',
METADATAFILE = N'C:\folder\WaitStats.xem')
WITH (max_dispatch_latency = 1 seconds);
That will record all of the waits for the query, if you compare hot vs cold the differences we know where to look instead of guessing
You can do it yourself, here: sqlskills.com/blogs/paul/…
So you know I'm not doing any hocus pocus
 
what's wrong with server level if only the interesting queries are running during that time?
 
It's not fine grained enough
It's like working with the SAN vendors, "I don't see a spike in latency" yet storport records a 15 second wait
 
as in, can't assign a wait to which query? or stuff in the internal pool would add to it?
 
server level everything adds to it
hard to attribute it to one single thing
plus we only get what changed
This way we get what changed, how much it changed, and each individual change so we can look for spikes
Magic number: 23 minutes, that's how long I waited
 
11:26 PM
for the phone thing?
are wait stats from the xml of an actual plan sufficient?
 
@JoeObbish There are issues with those...
Yeah for the phone
I'll assume I'm fired
 
ok
so four extended event sessions
one per session
 
1 at a time
just change the session id and copy the xml
 
11:28 PM
well, the issue seems related to concurrency
but I can start with individual queries
(the reason that it's taking so long is that some partition switching and other stuff happens during ETL and I don't have the code on hand to do that)
 
jesus that script is barbaric
 
@sp_BlitzErik Well jesus was like 2000 years ago so it'd barbaric abouts then
 
that's the one i use
suppose i should add a couple of the newer waits to that, eh?
 
--> IF (@waitfor LIKE '%:%:6%.%') <-- how to speak teenager
 
srsly
 
11:34 PM
would you accept the session waits dmv?
 
@JoeObbish If I have to
 
I'm just not sure what you're looking for
 
we're not sure what we're looking at
so it's fun for everyone
 
@JoeObbish Waits, individual per query
With the ability to know if it's a resource wait or a signal wait
If you want to do server level waits that's fine I guess
at least it something
 
show him how to do it with pssdiag ;)
 
11:41 PM
... seriously the up arrow thing Paul told me today has changed my chatting life
Dude I'd totally configure a pssdiag
The issue I have, personally, with pssdiag is it's a bit heavy handed
 
check out this guy, angling for a job at sql skills
 
how do you want latch info?
 
@JoeObbish medium rare
@sp_BlitzErik Paul white?
 
i don't think he wants to work that much
they use pssdiag to monitor client servers
 
because it works pretty damn well, just a bit heavy
less havy when you take trace and swap it with XE
if you pair down the events it runs fairly ok
 
11:49 PM
oh god, i still have the xml index creation in there
what an idiot
 
first query is running
 
@JoeObbish I charge by 15 minutes increments
 
it
it's going to be all LATCH_EX waits
based on sys.dm_exec_session_wait_stats
and the actual query plan XML
 
@JoeObbish you watch to speed that up?
 
hm?
I already know what the latch waits are going to be: BUFFER
 
11:53 PM
> mfw he still doesn't calculate avg ms per wait
> mfw it's not broken down by cores
 
So basically the main waits are parallelism
 
-_-
 
if only sp2 were out
ahem
 
1.3 seconds on latch_ex for something that takes that long is negligable
@JoeObbish I feel you
but like, not a creepy perv way
 
the waits don't add up
SQL Server Execution Times:
CPU time = 244328 ms, elapsed time = 91275 ms.
MAXDOP 8, remember
 
11:57 PM
you know that 1) MaxDOP doesn't mean linear 2) there are waits
3) it's a vm
 
yeah, I know that
but this is a carefully constructed query
which I know has some issues currently with a cold buffer pool
 
vm cpu timing is full metal potato
 
same query with a hot buffer pool:
 
it even messes up stats time
 
SQL Server Execution Times:
CPU time = 231344 ms, elapsed time = 29623 ms.
Are all parallel queries linear? Of course not. But this query can do as well as 7.8
 

  last day (690 days later) »