« first day (467 days earlier)      last day (222 days later) » 
00:00 - 19:0019:00 - 00:00

12:01 AM
I finished my first new post for erik's site
spent five minutes trying to fix line breaks with formatted SQL code
why does that always happen?
 
12:38 AM
i think i'm finally ready to put some scientific effort into figuring out why self joins often perform better than key lookups
 
what's your hypothesis?
 
magick
 
 
2 hours later…
2:45 AM
@PaulWhite I love the tweaks!
@PaulWhite When you unrolled the loop, did you remove the line of code that copies the input parameters into the array that you were looping over? I still see a non-trivial difference when doing that, even in your latest code.
The vast majority of the CPU is spent allocating arrays in the latest iteration.
 
@JoshDarnell sounds like an array allocation problem
 
@JoeObbish I agree.
Also: your mom
Okay, goodnight.
 
 
1 hour later…
4:01 AM
I got a blog post in the bank
I don't think this has ever happened before
 
 
1 hour later…
5:15 AM
@JoshDarnell I can't have done. I just tried it again (see updated answer) and it is 10% faster again. Thanks!
 
5:47 AM
If it gets any faster it'll be faster than an empty function
 
 
5 hours later…
11:13 AM
@PaulWhite empty functions are the best kind
 
@PaulWhite No problem!
 
@ErikDarling you're an empty function
 
11:40 AM
@PaulWhite why thank you
 
fully optimized
 
I definitely feel fully optimized right now
 
12:24 PM
I really want to participate in T-SQL Tuesday. But every month when the topic comes out I just...have nothing to say about that topic.
 
What's the latest?
 
@JoshDarnell same
 
Puzzle or quiz: what are the practical use cases for Hekaton?
Did I win?
 
nsolved ystery
 
12:34 PM
@JoshDarnell try mongodb monday or teradata thursday
 
@JoeObbish no u
 
12:48 PM
@ErikDarling sounds unrealistic
 
CREATE FUNCTION dbo.EmptyIterator()
RETURNS BIT
WITH SCHEMABINDING,
    RETURNS NULL ON NULL INPUT
AS
BEGIN
    RETURN CONVERT(BIT, NULL)
END;
 
 
2 hours later…
2:46 PM
max server memory set to 768000 MB
VM has 921000 MB
Failed Virtual Allocate Bytes: FAIL_VIRTUAL_COMMIT 1441792
no other apps on the OS
 
You're making it too easy Joe
 
guess leaving 1/6th of the memory isn't enough
ridiculous
 
You could, perhaps, not use a VM
 
I doubt that sqlservr.exe checks if it's a VM and decides to go crazy with memory
 
3:11 PM
if enduser == 'joe obbish'
    go.crazywithmemory
anyone feel like writing a blog post about how unclosed service broken conversations cause terrible memory pressure?
maybe a developer?
is there a developer in the house?
 
I vowed to never use service broker again
 
3:33 PM
@JoeObbish in case you didn't look: An Extra Special Guest Blogger: Joe Obbish.
this is so weird
OOH I GET IT
lol
hahahahahha
haaaaaaaaaaaaahahahahahahahaha
 
> Posted in: Joe Obbish
Uncomfortable.
=P
 
don't be CRASS
 
Tomorrow is going to be FUN
 
doctor fun?
 
@ErikDarling Don't be CSRSS
 
3:43 PM
> your mom
 
@ErikDarling Patch tuesday
 
@SeanGallardy Is that a Windows joke?
 
@PaulWhite 150%
 
😎
 
Every patch tuesday I wonder if my laptop will start up
 
3:44 PM
#SQLDataWins is back! - is it "back" because they deleted the first one?
 
@SeanGallardy Is this mainstream 1903?
 
@PaulWhite They've been trying to push it to me for a month
 
I installed it a few days ago. Seems fine.
 
Fun fact: If you have no room on your C: volume.... you can't get updates
 
3:48 PM
Haven't noticed any big differences in my day-to-day.
Took a while to install though.
I hope they're happy.
 
Erik didn't send you any nvme?
 
That's still on 1809
I'm not crazy
 
lololol
 
is that why all my vms took 45 minutes to update?
 
Are they signed up for the Insiders programme?
Otherwise, could simply be a VM problem
 
3:58 PM
ha ha ha insiders
 
I wish I had like 2 weeks and a full lab to do a bunch of vm testing
 
what
 
my old testing is out of date and I don't have access to esxi anymore
 
@SeanGallardy is this a quote from the people who test CUs?
 
3:59 PM
It's easy to test a VM. Write down the word FAIL.
 
You know MS doesn't have testers anymore, right?
 
They have Insiders instead
 
But they have a suite of robust automated tests of course, right?
 
A whole user base of alpha testers
 
4:00 PM
yes
 
Loss of SDETs, Windows bugs skyrocket, new releases are full of huge issues - nope I don't see a correlation.
 
they're called "end users"
 
@SeanGallardy SDETs?
 
@PaulWhite What Testers where officially called
 
4:00 PM
other than "hey you"
 
I thought they were SREs
It is hard to keep up with acronyms
 
Also, I think this fits me pretty well. Honest feedback before I purchase... opinionatedsql.com
@PaulWhite IKR
 
someone stole that domain name
 
looks like it's available
 
top men are working on it
 
4:02 PM
clicks buy
 
see
 
@SeanGallardy I like it.
How about authoritativesql.com though.
 
I both love and hate you all
3
 
journeytoauthoritativesql.com
 
4:03 PM
@JoshDarnell I think we know I'm nowhere good enough to have "authority" in my name. That bar is set too high for me.
 
Peter Jackson could make six films about a domain name like that
 
negative50percentmastertuner.com
 
is microhard.com available?
 
brutal
 
someone's making their own jokes
 
4:04 PM
@SeanGallardy One could argue about the highness of that particular bar.
 
limbo.com
 
Paul must be having extra cheeky wine today
@JoshDarnell True, I was being funny about being passive agressive
 
last bottle of standard pinot before I hit the posh stuff again
 
ah, you're slumming it today
 
4:06 PM
drinking what the peasants drink
 
one more case and paul will blog on my site too
:D
 
aka staying in my lane
@ErikDarling not as long as you label New Contributors with a waving hand
or "Guest"
 
no one is labeled
 
Their title should be data lifting partner
"I'm a data bro"
 
34 mins ago, by Erik Darling
@JoeObbish in case you didn't look: An Extra Special Guest Blogger: Joe Obbish.
Joe needs a lawyer
 
4:09 PM
Also, Erik told me I was signed up for his newletter already
 
well
 
I just put my information in and it said I was now signed up
 
joe is free to leave whenever he'd like
if he weren't i'd have to call him an extra special blog prisoner
 
Spoken like a true Executive Bouncer
Sorry, Lead Bouncer
 
How about co-blogger? VP of Blogging Services?
 
4:09 PM
what would you like your blog title to be
 
> You're free to leave right now, pal
 
co-blogger insinuates teamwork
joe just publishes whatever whenever
 
Blogging Partner as a minimum I'd say
 
@ErikDarling SQL Data Blog Authority Guru
 
he's a LOOSE CANNON
 
4:10 PM
Possibly Gold Partner
 
@PaulWhite for what?
@ErikDarling fake news
@ErikDarling this is accurate though
 
@JoeObbish To get a better label/title
 
what would you recommend?
 
Senior contributing author?
 
The transcript is full of helpful suggestions
 
4:11 PM
@PaulWhite doesn't seem likely
 
> Technical Consultant and Reviewer. Also, Boss Man
@JoeObbish It's been an unusual day
 
that makes me sound like I work for Erik
if you read the blog post carefully you'll discover that Erik works for me
 
yeah, who'd wanna do that?
 
> Columnstore, Animu Expert
 
2 mins ago, by Paul White
Blogging Partner as a minimum I'd say
 
4:13 PM
sounds too romantic
 
@JoshDarnell This has my vote
 
what about "blogging new friend"?
 
guys, self-joins beating out key lookups is starting to make me nervous
 
Joe should turn Erik down with a FAIL_VIRTUAL_COMMIT message
@ErikDarling Self-joins are more honest
 
@ErikDarling Got a repro script?
 
4:15 PM
do you have SO2013?
 
just 2010
 
lemme see if it works there
it's not as impressive but it works
on 2013 the difference is more pronounced
 
looks like it needs a spool
 
poverty spool
 
only for those who dislike performance
it's right there in the name
 
4:20 PM
i'm not sure if it's just the position of the sort in top plans
could be
without top it might be useless
 
from the visual I would say so
a bookmark lookup is quite tightly tied to its parent
 
I would suspect the sort having more to do with it than the self-join aspect
 
there's not much opportunity to fit another operator between e.g. seek and lookup
whereas an ordinary join has no such restrictions
 
but the self join seems a reliable way to get the sort
@PaulWhite don't optimized key lookups do that?
 
@ErikDarling sort of (hence "not much")
 
4:25 PM
HEH
 
The other main example being the Sort part of a perf spool
 
you're a sort part of a perf spool
 
better than being an empty function
 
4:26 PM
missing index detected
 
scrub
 
so the real question is now...why SQL Server can't push the sort down in a key-lookup plan?
or why the sort position makes such a difference?
 
it just doesn't
here's the plan xml if anyone is interested
 
It's not allowed in general. A sort introduced to optimize a loops join happens for a different reason.
 
what's the reason?
 
4:31 PM
Just a general restriction about putting stuff in between things that were originally one operation
 
i see
hm
also that was the wrong xml
 
It could mess up e.g. how long locks are held
It's probably overly conservative
 
I struggle to remember but I think a Bookmark Lookup (2000-style) was always the operator immediately following the parent data access operator
 
that's finally the right xml
 
4:34 PM
Congrats
 
it's been an honor
i'd like to thank my parents for not paying much attention
 
Then it was split into Key/RID Lookup with NLJ
 
in the KL plan the lookup executes all ~million times and the top removes rows after the join
in the SJ plan the top seems to stop the sort after 1000 rows come out
is top + sort better than top n sort?
@_@
 
WTF
WTAF
Give it some actual thought
 
i am
i just like to say incendiary things while i do it
especially to drunken kiwis
and knights of the query store
 
4:38 PM
Sorting the small input is obviously cheaper than sorting the full result of the join
And you have to perform the full join in order to sort it
 
@ErikDarling lol
 
@PaulWhite so it's a join problem and we should just use cosmosdb
 
does the use plan hint work in this case?
i.e. can you force the self-join plan on the key-lookuping query?
 
i haven't gotten that far
 
4:45 PM
@ErikDarling Replace the SELECT list with u.*, ROW_NUMBER() OVER (ORDER BY @@SPID)
@Forrest No
They're logically the same, but there's no transform for it
 
@PaulWhite Cool. So Erik ran across an optimizer blindspot?
 
"no one knows all of the possible transforms"
 
except paul, of course
 
this must be how joe feels every day
annoyed and empty
 
@Forrest As much as any missing transform could be called a blindspot, I suppose so
But there must be a thousand more common missing bits
It's a fairly contrived example
With an easy rewrite
 
4:53 PM
what's the easy rewrite? the self join?
 
And arguably sql.kiwi/2011/02/…
> A much better execution plan would scan the non-clustered index, assign row numbers, filter the records, and only then use a Key Lookup to fetch the off-index columns. Since we know we will only be returning a maximum of 50 rows, it seems likely that the cost of 50 lookups would be more than offset by scanning the much narrower non-clustered index to begin with.

Unfortunately, SQL Server does not yet include logic to spot this sort of optimisation, and always places a Key Lookup just after the Index Seek or Scan it is associated with.
Jesus that post is over 9 years old
 
@PaulWhite yeah it often seems to come back to that pattern huh
 
Yep
 
someone should write that into EF
 
The only thing I'd like to write into EF is an unhandled exception
 
4:59 PM
i meant "entity framework" not "erik's face"
 
🍷135% complete
 
new bottle time
tell us a story, grandpa
 
(there was half a glass left in the bottle)
I just told you a story from 9 years ago, sheesh
 
i was alive then
 
Did you try the ROW_NUMBER thing? It should separate the Top Sort into separate OPs
An excuse to post from my third platform sqlperformance.com/2015/04/sql-plan/…
I'm interested to hear why you were using Service Borker
 
5:03 PM
@PaulWhite i added it to just the KL plan but the times didn't change
 
Right
27 mins ago, by Erik Darling
is top + sort better than top n sort?
So not much then
For n > 100
 
oh i see what you mean
well played
 
thanks
I've been practicing
Parameter sniffing is a real bitch eh
 
final boss
 
Someone asked me once why Key Lookup couldn't be implemented using hash join
I stared back at them
Until they went away
17 hours ago, by Paul White
Truly I feel we have advanced the state of the art in here today
Wine Overflow completed
 
5:09 PM
@PaulWhite TEEHEE
 
5:20 PM
> I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
 
last week someone asked me if a cte was the same as a table variable
so i get you
in some small manner
 
I think I saw that on Twitter
 
I wondered at the time what the context for that was
And thought better about asking
 
that's you
always thinking better
i should start vaping so i can think better
nicotine is magical
 
5:22 PM
The magic is all in the fruity flavours
 
i'd probably just get mint
i always favored menthols
 
Me too but I bored of minty vapes quickly
 
white people wouldn't take them if they asked you for a smoke
 
Seemed basic
@ErikDarling Oh that's so true! I used to smoke menthols partly for that reason
Without the racism
No one wanted a menthol cigarette
 
well i meant it because mostly white people would ask me for cigarettes
then turn them down
"oh, newports, nevermind"
 
5:25 PM
yes I was joking
Asking for a vape is much less common. Someone did ask to borrow a battery once.
 
can you jumpstart a vape
 
I wear a solar panel hat
The whole world revolves around battery anxiety these days it seems
 
someone should fix batteries
 
can you imagine if they did
 
i'd be keen on a nuclear powered vape pen
 
5:27 PM
sounds risk free
you've seen videos of vape batteries exploding yes?
putting a nuke in my jeans pocket seems ... unwise somehow
I think I'll wait for the singularity-powered devices
What could go wrong
 
i'm surprised your pants have pockets for some reason
seems superfluous
vestigial, even
 
right I'm done see you later
 
adios
 
5:48 PM
I feel like having your vape pen hooked up to a major body of water to keep it's nuclear power source cool seems a bit limiting in the devices mobility
 
If you had multiple batteries, in case one ran out, you could call it an extremely hot spare.
 
my friends who vape seem to constantly be charging their pens
or carrying multiples
seems like quite an endeavor
 
I think it's because people use them pretty constantly.
luckily all of those batteries are pretty interchangeable.
 
aren't they expensive?
 
Not really.
20 bucks or so.
 
5:55 PM
i bought my friend a thing and it was like $70 for the pen and four cartridges
 
depends though. I've seen them vary from 15 bucks to like 150
Not that I'm an expert back when I smoked I just smoked and massively disliked vaping.
 
vaping wasn't even a thing when i smoked
i can imagine i would have been happy to switch
 
I found it just made me smoke more.
 
i would like to have not dealt with quitting or worrying about cancer
 
@Lamak Paul was the one who said that
 
6:18 PM
Guys I actually tuned a query.
For my job.
 
nahhhh
 
@JoshDarnell Those missing index hints sure are useful, aren't they
 
Original: CPU time = 1954 ms, elapsed time = 816 ms.
After combining two CTEs: CPU time = 110 ms, elapsed time = 151 ms.
After adding indexes: CPU time = 0 ms, elapsed time = 69 ms.
 
More seriously, congrats. It looks like you caught the addiction now.
 
@Forrest my feelings :o
 
6:20 PM
>:D
 
did you combine CTEs into a temp table?
-_-
 
It's a view.
 
@JoshDarnell that time must be very satisfying to see.
 
@JoshDarnell did you turn the view into a stored procedure?
 
@ErikDarling Feel you there. Quitting wasn't particularly fun neither was cancer.
 
6:24 PM
which was worse?
 
@ErikDarling I didn't, for ORM reasons.
@Zane Haha it really is!
 
@ErikDarling Oh the chemo for sure. However it's easier to do because you don't really have any choice you know? Quitting smoking is harder because you can always just buy a pack and give up the misery.
Chemo = shittier
quitting smoking = harder.
2
 
i thought i was going to die several times while quitting smoking
 
I quit smoking on like my 5th attempt. Chemo I got through on the first try.
 
6:45 PM
@Zane ain't that the truth
not that I've done chemo though. I have seen family members go through it.
 
6:56 PM
This week, we have an “ask me anything” panel with SQL Server experts @johnedba, @sqL_handLe, and Joe Obbish! Get your questions in now or ask them live! Details at http://madpass.pass.org
 
"Joe enjoys baking and sharing these treats with his coworkers." I did not know this.
 
So, uh
Can I Skype in to that meeting?
 
00:00 - 19:0019:00 - 00:00

« first day (467 days earlier)      last day (222 days later) »