« first day (2636 days earlier)      last day (2236 days later) » 

8:04 AM
 
8:52 AM
Morning
We are probably in the last series of cold days this season, and it ends either today or tomorrow, which is very inspiring.
 
 
2 hours later…
10:37 AM
1
Q: To Normalize or Not to Normalize

Adam ThompsonIn general, I understand that normalization is usually beneficial even with the join costs. However, I came up with an interesting dilemma recently. What if the data is duplicated but unlikely to ever change. It's possible, but I would not anticipate it. I have a nutrients table with a unit col...

To Cry or Not to Cry
 
@AndriyM apparently, it was yesterday here
 
Not a bad self answer here, from my fellow Greek:
Yes. The first query says "find me the children of X and then all their blue descendants" while the 2nd says "find me the blue children of X and then all their blue descendants" (where "blue" in the property checked in the subquery). — ypercubeᵀᴹ 2 mins ago
I'm off to bye a new phone this weekend. What do you guys recommend?
No need on running the Internet, as Paul's phone ;)
 
11:04 AM
@AndriyM first day of beautiful sun here
@ypercubeᵀᴹ I love my old one plus but they aren't cheap any more. I hear good things about the upcoming Nokia but that doesn't help you if you want one now
 
@TomV I'll probably get some cheap Samsung or Huawei
The one I use now is 4 years old. Good only for phone calls.
Which one would assume is the main purpose of a phone ...
The one time I bought an expensive phone, I regretted it, so I tend to buy cheap ones.
 
@ypercubeᵀᴹ cheap isn't exact science but anything over 400 is too expensive for me too. What price are you looking for?
 
not more than 200
 
I had a Samsung j series as a replacement and disliked it
 
I was just looking online at J3, J5. Around 170-230 pounds
(and 130 for HUAWEI P8 Lite 2017)
 
11:18 AM
I'd consider a Nokia 3 or 5 then
But I have a preference for near stock android
Which Nokia has
 
11:34 AM
@ypercubeᵀᴹ I enjoyed my Huawei Y6 Elite. Cheap as, but easily good enough for me.
In some ways I prefer it to my current iPhone 5.
It's tough to advise people on phones though. They are such a personal and subjective choice.
 
12:11 PM
and really it depends on if you need your phone for oltp or a data warehouse.
 
absolutely
 
12:31 PM
@PaulWhite feel like fixing an 8 year old bug?
 
@sp_BlitzErik I doubt it. Details?
 
> The optimiser needs to translate this into plan that can be executed by the Query Processor.
 
@sp_BlitzErik Where's the bug?
 
"needs to translate this into plan"
a plan? plans?
 
Ha! I still didn't see it LOL
 
12:38 PM
exposed to the cruel light of day
 
@sp_BlitzErik Fixed, thank you.
Confirmed: Open Live Writer works with ancient SQL Blog posts.
 
12:56 PM
i gotta try that thing out
maybe i'll write better blog posts
nobutseriously
 
The one USP of Live Writer/Open LW for me is being able to CTRL-V an image.
 
oh i just did wiggly fingers
 
Say what
 
Ok that's more visual, but what does it mean
I suppose I can guess
Actually that's a perfect explanation
Honestly PrtSc straight via Snagit to blog post is so much less distracting than saving and uploading.
 
1:02 PM
well yeah i hate having to screen cap > save > upload > come up with a caption > maybe adjust some stuff
 
That WP nonsense is just not productive
But I guess it depends how you work.
Joe seems happy enough leaving placeholders for pictures and adding them later.
 
user image
2
i made that yesterday
and just wanted to plop it in
but then i had to work
v. upsetting
 
Star added with passion.
 
i wrote that blog post about unique nonclustered indexes the other day
i was hoping it would provide a natural explanation for why some key lookups have a sort before the nlj
didn't pan out though
 
@sp_BlitzErik Not published yet?
 
1:08 PM
nah in the queue
 
A sort before the NLJ for a Key Lookup is just the regular sorted-order optimisation.
i.e. sorting the rows into clustered index order
 
yeah, that's why i was hoping i'd get that plan with the unique index
since they'd be leaf level
unless they're ordered there too
the mind boggles
 
Well rows can only come back from a nonclustered index on (A, B, C) in order of (A), (A,B), or (A,B,C).
If C is the clustering key, a sort is still required to get rows into order of C.
Assuming I'm imagining your test correctly.
 
it was a two column table. i had more complicated stuff in mind, but i wanted to keep the first one simple, reference it in one about seek predicates vs predicates, and then do something more grand.
i just can't do it all in one post. it'll crush people joe's age.
 
Well that's true
You should write some brutal piece about row goals.
Anyway feel free to flick it over if you like.
 
1:16 PM
sure, you're awake and all that
 
Yeah but it's Sunday so
 
already!
 
9:18am yesterday EST I'm told
17 hours behind. Talk about slack.
 
oh spit into the wind
not all of us had the privilege to be born in nz ;)
 
I should check my arbitrary timezone privilege eh
 
1:24 PM
they should use amex. you have to pay the full amount every month or they shut your card off.
really helps you keep spending in check.
 
You should suggest that. Sounds v sensible.
 
this thing sure is taking its time downloading the blog theme
 
Yeah that can take a few minutes. One time deal though.
New Post: Temporary Post Used For Theme Detection (815bd2a5-d3a0-4712-a705-1a907e89fee2 - 3bfe001a-32de-4114-a6b4-4005b770f6d7) https://www.brentozar.com/archive/2018/03/temporary-post-used-for-theme-detection-815bd2a5-d3a0-4712-a705-1a907e89fee2-3bfe001a-32de-4114-a6b4-4005b770f6d7
LOL!
 
sad panda
 
Automation will save us all
 
1:28 PM
oh can you edit multiple posts at once
 
It's like magic I know
 
too bad i can't blog about any of the stuff i'm currently looking at
 
Secret Squirrel?
 
Secret Sock
 
1:34 PM
nothing you don't do with your eb commands
 
Certainly. That reminds me I should check what's new on that front in CU5.
 
i'll be watching
i mean waiting
waiting
 
ha ha ha
Hopefully they've at least enabled DECLARE statements now.
No it seems multi-statement UDFs are still not Froided.
For example:
CREATE OR ALTER FUNCTION dbo.CountHistoryRowsForProduct
    (@ProductID integer)
RETURNS bigint
WITH SCHEMABINDING
AS
BEGIN
    DECLARE @r bigint;

    SELECT @r = COUNT_BIG(*)
    FROM Production.TransactionHistory AS TH
    WHERE TH.ProductID = @ProductID;

    RETURN @r;
END;
 
what's the query calling it?
 
SELECT
    P.ProductID,
    HistoryCount = dbo.CountHistoryRowsForProduct(P.ProductID)
FROM Production.Product AS P;
Gets froided if the function is a single RETURN with nested SELECT:
CREATE OR ALTER FUNCTION dbo.CountHistoryRowsForProduct
    (@ProductID integer)
RETURNS bigint
WITH SCHEMABINDING
AS
BEGIN
    RETURN
    (
        SELECT COUNT_BIG(*)
        FROM Production.TransactionHistory AS TH
        WHERE TH.ProductID = @ProductID
    );
END;
Been that way since CU3 though.
 
1:46 PM
well hopefully the use cases get expanded in vnext
 
Oh I'm sure they will. It would just be nice if more were available for hack testing right now.
i.e. without signing an NDA.
And without having to set up a VM to run some dodgy bits.
 
you've got lots of space for vms and dodgy bits now
 
yeah I just don't wanna
 
2:06 PM
not as young and hungry as you used to be
 
I suppose I could do it on my spare laptop
 
first world paul
 
Still kinda pointless though. Wouldn't be able to talk about it with anyone interesting.
Besides Sock & Co. only want people with real-world use cases.
 
yeah i have so many of those
 
3:05 PM
@PaulWhite "froided"?
 
 
2 hours later…
5:10 PM
Jeeeez... "these 100 databases had 85329 scalar UDFs"
Damn programmers
 
I suppose if you're used to a system where encapsulation and reuse are good ideas, there'd be little reason to question that habit when moving to programming in a database.
And, in fairness, the main problem with scalar functions is one of implementation.
Then again, people write fairly dreadful function code as well so blame all around :)
 
i've never heard anyone say "i wrote the function this way because i couldn't write it as an itvf"
 
Yes. The issue there being one of realising it would be better to write an inline table-valued function.
As someone commented to me recently, if I'm returning a scalar, why would I use a table-valued function?
 
5:30 PM
first reasonable explanation i've ever heard
shame you probably made it up
 
I'd support not being able to create scalar functions unless you enable a global trace flag
 
it should have an 8 in it
 
@Paul White can you elaborate? I thought that as it returns a scalar it would perform most efficiently as a scalar function, not a table-valued one. — Ed Avis Mar 7 at 14:58
 
@PaulWhite probably related to Ed Arling
2
 
ha ha ha
 
6:16 PM
@ypercubeᵀᴹ continuing the null theme I see
 
@PaulWhite ?? You mean my comment in the GREATEST/LEAST question?
 
The function has an issue with nulls, too. If @a = 100 and @b is NULL, then it will return NULL, not 100. (which may make sense in a way, if we don't know one of the two values, then we can't be sure what the least is!) — ypercubeᵀᴹ 38 mins ago
yes
 
It's one of the problems with nulls.
Not all aggregate functions treat nulls the same way.
 
My favourite, I think, was the check constraint question someone, maybe dezso or swasheck asked once.
9
Q: Switching Data In Fails with "allows values that are not allowed by check constraints or partition function on target table"

swasheckGiven the following -- table ddl create table dbo.f_word( sentence_id int NULL, sentence_word_id int NULL, word_id int NULL, lemma_id int NULL, source_id int NULL, part_of_speech_id int NULL, person_id int NULL, gender_id int NULL, number_id int NULL, ten...

That one.
 
Ah yes, I remember.
 
6:29 PM
@ypercubeᵀᴹ can you check if is it correct?
 
@PaulWhite by the way, I don't think that scalar function answer deserved -3. It's not the best option by any means but ... I edited to include the various comments (your included ;)
 
@PaulWhite it's hard to believe that answer
 
@ypercubeᵀᴹ It's just votes. But honestly of all the available options, a scalar function is probably among the worst.
 
scalar functions, triggers, eewww
 
@JoeObbish You mean it is not correct?
 
6:40 PM
@PaulWhite no, not at all
just hard to believe it works like that
 
I see
 
That's more or less how it works, actually. A value is allowed when it's hard to believe that the check condition is false.
 
heh
 
7:33 PM
@ypercubeᵀᴹ which phone did you end up getting
 
8:26 PM
Oh dear Australia
 
8:36 PM
@PaulWhite the cricket incident?
 
8:52 PM
Yes indeed
 
@TomV none today. I'll go tomorrow
 
@PaulWhite yah that was ridiculous
You could see the coach looking like 'I know what is going to happen but I hope nobody notices'
And then the player put both hands and the ball in his pants smh
 
The press conference was agonizing
 
9:08 PM
I missed that part
 
9:25 PM
Wow, just watching the conference video
Is the team on a plane back home?
 
No these are Australian cricketers. Barely aware they've done anything wrong
 
He practically admitted that the whole team knew or agreed about it
 
And did explicitly say the whole "leadership team" planned and agreed it. Quite shocking
 
Link to the conference.?
NVM found it
'I'm embarrassed to be sitting here' rightfully so
What a joke
 
9:44 PM
I had to check it wasn't April 1
 
Which is the maximum value of X for SELECT TOP (X)?
 
@McNets depends if you have a foreign object and some tape in your pants
 
I mean, instead of use SELECT TOP 100%, use the maximum allowed value
 
@McNets bigint max
 
@McNets I was kidding. See the cricket comments
 
9:48 PM
@TomV I know ;)
@JoeObbish thanks
 
The Zanes of ancient Olympia were bronze statues of Zeus. The name Zanes was the plural of Zeus in the local dialect. These statues were dedicated to Zeus and they were erected with the money of fines imposed by the judges to those athletes did not respect or violated the rules of the Olympic Games. Besides the fines, the judges also imposed body punishments or exclusion of an athlete from the Games depending on how severe their violation was. Today, only 16 pedestals (stone bases) of the statues survive. They are located one next to the other in front of the monumental entrance to the stadium...
 
10:29 PM
and a funny reading, from national geographic (Australia): nationalgeographic.com.au/history/…
 

« first day (2636 days earlier)      last day (2236 days later) »