« first day (4277 days earlier)      last day (591 days later) » 
00:00 - 14:0014:00 - 00:00

12:18 AM
does this look generally accurate
even if some might need caveating
 
12:46 AM
Yes caveat outside statement scope for phantoms and repeatable reads under RCSI
Seems some web designers use asymmetrical fonts
@ErikDarling
 
the final version uses a nicer font
at least i like it
 
Hardare
 
oh boy, yeah
glad that cost me money
dickheads
 
What's the scenario for deadlock under RCSI
 
oh uh
i was just looking at that and realized it was wrong
_v3
 
12:55 AM
It's tough to cover every nuance in simple tables
 
yeah
but i think it gives people the right general sense of what to expect
which is the intent of the post
if they want details, they can ask someone from new zealand
 
I thought maybe you referring to a writer-writer deadlock but that's almost always possible
RCSI taking update locks when identifying rows to change etc
Hence difficult to capture everything
 
oh no, just a copy/paste error
 
whenever i talk about isolation levels i have a hard time figuring out why repeatable read exists
it's like weak serializable but with basically all of the locking drawbacks
i'm sure someone thinks it's handsome
i just always felt like if you were going to go that far you may as well go to serializable
 
 
5 hours later…
5:35 AM
@ErikDarling I guess for when you need a few things from different tables to be true all at the same time. For example, the account must have a positive balance, the item must be in stock, there must be a billing address, then you can insert the order. With RC any one could be true but you can't be sure the first is still true when you check the last. With Serializable you get the extra range locks and lower concurrency.
'Morning all.
 
5:48 AM
@Zikato @Glorfindel will have to hire additional personnel to cope with all the broken links....
Morning
 
Morning
@JohnK.N. Yeah, I'm considering rewriting all my blog links from Docs. to Learn. to prevent the inevitable breakage.
It's not like Microsoft reverts their bad decisions
 
6:12 AM
That's what happens when a corporation is under no real pressure to improve
 
Corporations were a mistake
We had an interesting conversation about the WHERE 1 = 1 pattern in Slack yesterday.
With the FORCED PARAMETRIZATION it introduces a Filter operator with a Startup Expression Predicate. Is there any way it could negatively influence the estimates?
16
Q: Good, Bad or Indifferent: WHERE 1=1

WernerCDGiven this question on reddit, I cleaned up the query to point out where the issue was in the query. I use comma first and WHERE 1=1 to make modifying queries easier, so my queries generally end up like this: SELECT C.CompanyName ,O.ShippedDate ,OD.UnitPrice ,P.ProductName FROM...

 
 
2 hours later…
8:15 AM
@Zikato Database professionals write WHERE {d '1900-01-01'} = {d '1900-01-01'}
 
JEAGL, please.
 
@Zikato Try it and see what you find
 
Huh, that's pretty neat. What's this syntax called and when can I learn more?
36
Q: Curly braces in T-SQL

Tom HunterI've come across the following t-sql: SELECT {d'9999-12-31'} Which returns 9999-12-31 00:00:00.000. This seems to be converting the type of the string literal to a DATETIME. I can't find any documentation on this syntax and I'm wondering if there are any variations, for example if I have a l...

So it's the Sean-approved ODBC
 
8:31 AM
18 hours ago, by Sean Gallardy - Mostly Retired
Short version: ODBC
 
@Zikato So what did you find, comparing that with WHERE 1 = 1?
 
it didn't have the extra Filter operator, not even with the FORCED PARAMETRIZATION
 
Correct
> When the PARAMETERIZATION option is set to FORCED, any literal value that appears in a SELECT, INSERT, UPDATE, or DELETE statement, submitted in any form, is converted to a parameter during query compilation. The exceptions are literals that appear in the following query constructs:
> ...
> Additionally, the following query clauses aren't parameterized. In these cases, only the clauses aren't parameterized. Other clauses within the same query may be eligible for forced parameterization.
> * Constants specified by using ODBC extension syntax.
...
You can also write WHERE 0+1 = 1+0
 
WHERE P=NP
 
Long compile times on that one
@Zikato It's also a good way to show forced parameters not starting with @0
 
8:49 AM
So that's a neat trick how to avoid that. But in my original question? When the code base already uses 1=1, can the extra filter Operation cause bad estimates?
 
Anyway, I mention that because the best way to ensure something doesn't affect performance or estimates is for it not to be present in the first place. The start-up filter should always be estimated at 100% or 0% selectivity, but who knows what edge cases there might be, especially with such things on the inner side of a correlated join.
OTOH if you're using forced parameterization, you've already accepted you don't care much about estimates.
 
That's a good way to think about that
 
I imagine that's a better question than we will see asked on main today
Luckily, chat is excellent documentation
We should rename it "learn"
2
Sep 9 at 17:27, by Erik Darling
the transcript is not good documentation
(reference)
 
Well the question has already been asked (dba.stackexchange.com/questions/33937/…), I just wanted to have a discussion about a specific angle
 
I wonder how long I will remember to edit learn.microsoft.com links back to docs.
@Zikato The answer I gave isn't covered by that question tho
forced parameterization isn't mentioned I think, aside from obliquely in an Oracle answer
Not a big deal, I'm just saying
 
8:55 AM
> The question then really... does Where 1=1 cause bad things to happen? And if so, how can I tell?
I thought this could cover the bad estimates from the Filter operator
 
9:23 AM
Why would that be better? It essentially returns the same result as the original query but with a lot of duplicated rows. Say the table has a billion rows and there are 1000 different group_id values: returning a billion rows instead of 1000 doesn't look good to me. — ypercubeᵀᴹ 2 hours ago
 
Slap a DISTINCT on it and call it a day
That might make a good meme. Be right back
 
A senior dba knows to avoid distinct like that. They'd add an extra layer of CTE nesting with another partitioned window function and filter on row_num = 1
 
( •_•)>⌐■-■
(⌐■_■)
I strive to be a señor DBA one day.
 
10:21 AM
only Lamak is señor DBA. and occasionally billinkc ;)
 
Lots of recent interest in inserting dummy rows to Postgres tables with serial/identity
Reminded me of:
6
A: Insert multiple rows into a table with only an IDENTITY column

Andriy MAs of writing this, there is no way to insert multiple rows into just an IDENTITY column using an INSERT statement. The DEFAULT VALUES placeholder stands for just one row. And the INSERT ... SELECT syntax has no extension to support the same functionality as the DEFAULT VALUES clause. Instead, y...

and
22
A: how do I insert a default row?

Martin SmithTo insert a single row INSERT INTO RR DEFAULT VALUES; It is possible to insert multiple rows of default values by (ab)using MERGE MERGE INTO RR USING (SELECT TOP 1000 * FROM master..spt_values) T ON 1 = 0 WHEN NOT MATCHED THEN INSERT DEFAULT VALUES;

 
ooh, the first one is clever
 
@ypercubeᵀᴹ Would that work in Postgres' implementation of MERGE?
 
I usually just do GO 1000 or something
 
Have you tried set-based thinking
 
10:30 AM
I haven't even tried thinking. Why make it more complicated?
 
True
Oh MERGE seems to be a future thing for Postgres 15
 
@PaulWhite No idea, I'd have to check.
@PaulWhite dbfiddle.uk has a v.15 beta we can play with
 
I don't know what page that is, but that logo is fabulous.
 
10:41 AM
@Zikato It's the page I get when clicking your link. Works in an anonymous window.
 
Interesting. Unicorn doesn't seem to be on-brand for GitHub
 
Paul it works, yes: dbfiddle.uk/7JlPFV1F
 
@Zikato Seems related to 2FA login. Is fine if I'm not logged in, or freshly logged in.
@ypercubeᵀᴹ Great, thank you.
 
the only issue is that we can't use OUTPUT. not yet anyway
 
Can you create a database in dbfiddle.uk? To test a query with a different database setting, for example.
 
10:44 AM
@ypercubeᵀᴹ I didn't mean to waste your time there. I thought MERGE was mainstream already.
 
RETURNING for MERGE is to be added in next version (16)
 
@Zikato No.
 
@PaulWhite no problem. 15 is released end of month / next month.
 
@ypercubeᵀᴹ Worth adding to dba.stackexchange.com/a/317112/1192 do you think? Unusually not a CW answer
 
thnx added. and CW checked
I should probably add it to the old question by Jack as it works for serial as well, not only for IDENTITY
 
10:57 AM
Sure
 
Lively this evening
 
@ypercubeᵀᴹ You had a typo in your custom link (sever vs server). I fixed it.
 
@ErikDarling It's all ancient history now, but I suppose it goes back to when people were trying to define what isolation meant, and decided to categorize based on the phenomena one might observe with progressively looser versions of isolation.
also, morning
the world was a very different place 50 or so years ago when all this happened
 
11:19 AM
@PaulWhite 🤷‍♂️
 
@ErikDarling REPEATABLE READ has its uses. For example, you might not care that a row exists when you first read it, and if it appears later you would ignroe it, but you definitely want it still there when you read it again. SERIALIZABLE would prevent anyone inserting, which you don't care about, you only care here about the row you read disappearing.
 
@ErikDarling The earliest paper I could find quickly is this one from 1976. It speaks about degrees of consistency rather than concurrency phenomena, which is probably an ANSI SQL thing. The highest definition there is repeatable read. Perhaps phantoms weren't considered until later.
And yes, I realise I am overestimating your actual level of interest here
 
Just banshees
 
@Charlieface I think the issue there is you wouldn't ignore a row that appears later under RR.
 
Even I forgot about that one
 
11:29 AM
The transcript never forgets
 
maybe i should rephrase: i understand the academic reasoning, i've just never found a practical application where serializable didn't provide additional security
 
well, serializable is the highest level of isolation so that's a bit of a tautology
but sure, valid and sensible uses of repeatable read are quite rare
handy for people writing about lock escalation for example
 
I guess valid and sensible uses of READ COMMITTED are rare also....
 
it is garbage
 
If it was up to me, there would be two levels: SERIALIZABLE and SNAPSHOT
 
11:36 AM
I empathise with that view
 
The only two that ever have use, apart from READ UNCOMMITTED in certain debugging situations
CREATE VIEW empathise...
 
But how would that generate invoices?
 
But there are valid uses for both read uncommitted and read committed (locking and MVCC)
read uncommitted is fine if you don't care about complete accuracy or the possibility of a rollback
in a database with very few rollbacks, it's just a timing difference really
 
CREATE SYNONYM empathize FOR empathise...
READ COMMITTED? naah, it's just an easy get out "I never saw any issues so there aren't any"
 
@PaulWhite in every case where i've been okay with nolock, i would have been better off with rcsi/si
 
11:39 AM
If you do something enough times, eventually you will get a race
 
@ErikDarling yes but you're young and inexperienced
 
full of inexperience
 
RCSI and SI are both very sensible compromises
 
Best bit is someone says "I use NOLOCK because no-one else is writing, and mucho faster" to which I respond "so use TABLOCK" to which I get "but it locks the table" ??????
 
yeah ha ha
 
11:41 AM
Is anyone writing or no, make up your mind
 
maybe they're worried about other reads getting blocked
 
mucho faster - was that a señor DBA?
 
fits the facts
OTOH neither taking locks nor generating and maintaining versions is free
I remember being a bit surprised by the performance impact of ADR, for example
 
put the DB in read-only mode. Problem solved
 
@PaulWhite because there wasn't really any?
 
11:44 AM
@ErikDarling Reads don't block reads
 
yeah, we know that
 
@ErikDarling No, because it made a scan much slower and reported a much higher number of reads
 
@PaulWhite oh i thought you meant with generating the versions, not query hits
 
@Charlieface I think the joke is people who think NOLOCK is a good idea would also think readers block readers
 
didn't realize, JEAGL and all that, sorry...
 
11:46 AM
@ErikDarling Ah, I see. As I recall, generating versions was a little slower too, depending on in-row or PVS etc.
@Charlieface No worries. Erik can be extremely hard to follow. It's his brand, really.
 
it's how i fool people into thinking i'm smart
 
Well, you do dress nicely
And smell nice
 
DO GO ON
 
According to reports from reliable sources
The other funny thing to me is the people worrying about edge-case concurrency often write code that makes a mockery of such concerns
 
gotta have consistent marbles
 
11:51 AM
Slapping a DISTINCT on it will fix it
Good enough for government work etc.
Oh, that reminds me, there are signs Microsoft are planning to version metadata and DDL for 2022 or later
 
Meaning SNAPSHOT on metadata?
 
Meaning SI would no longer barf when faced with metadata/DDL changes
Presumably, it would also allow user transactions running under SI to access versions of metadata, but I don't know about that
Many experimental things show signs of life and never make it to supported release, sadly
 
that's sort of interesting
 
Separately, in-memory optimization for master.
 
but why
 
11:57 AM
I forgot, or can't say. One of the two.
Have you spent any time with RC0? I can't seem to get motivated.
 
only to compare it to 2.1
 
same
 
i hear rc1 is near
maybe even this week
 
yay?
 
i'll take what i can get
getting hard to find things to keep churning out blogs about
 
11:59 AM
I'm waiting for the week before summit before telling them about the crushing bugs I found so far
7
 
good man
 
proportional payback for unnecessary URL shenanigans
 
i appreciate your sense of spiritual justice
 
I'm surprised Sean hasn't been renamed a few times
Gean Suelardy perhaps
@ErikDarling I do strive to achieve balance
Yet another variant is: WHEN NOT MATCHED THEN INSERT (id) VALUES (DEFAULT)Lennart 4 mins ago
Comment on a Community Wiki answer
What is wrong with you people
 
strange reverence for a community wiki
 
12:07 PM
can't be too careful about upsetting people
 
Some people get so protective of their posts that others get wary. I can never see the problem of reasonable additions/modifications to a post, and I'm happy for anyone to edit mine.
I think every post should by definition be a community wiki
 
@Charlieface I understood that reference
 
a sudden pivot though
 
@Zikato I wasn't making any reference, but now you got me curious...
 
yeah idk. How dare you make my post better!!!11!
@Charlieface I hear there's a popular SO answer that had a great edit rejected just recently
might be just a rumour
 
12:11 PM
I guess it depends on what is reasonable
 
@PaulWhite DDW - Decellerated Database Writes
 
Oh that one. Yeah probably the most popular I did that to, but I've done it to many others. Some people get annoyed, others don't. Check out the revision history on this one stackoverflow.com/questions/73352468/… stackoverflow.com/posts/73352933/revisions
 
I meant this one
Sep 5 at 19:51, by Charlieface
@PaulWhite IMO you shouldn't edit someone else's answer to drop in links to your own blog, even (or especially) if you are the mod. Self-promotion and all that. Just put in a comment, I would probably have added it anyway.
 
@HannahVernon True. But when you need to rollback that long running txn in a hurry or have an unexpected server restart. It's a reasonable trade-off for many, I'd suggest.
@Zikato Oh well we don't talk about that
 
my bad
 
12:13 PM
Very awkward now
 
@PaulWhite 100%
 
You ruined chat
 
everyone leave
chat is CLOSED
4
 
@Zikato I stand by that: edit in whatever you want to improve the post, but promoting your own blog should go in a comment, otherwise it looks like self-promotion
In other words: if you want to edit the blog text into the post, go ahead, just not the link.
 
i think that goes against attribution rules
 
12:15 PM
I'm sorry for closing chat :(
@Charlieface That example helped me see the distinction. Thank you
 
@PaulWhite What was that rollback for? I said "I would probably have added it anyway", which is why I didn't roll it back.
TRUNCATE TABLE chat
 
@Charlieface I undid my edit you muppet
If you enjoyed this answer, you might also enjoy my sightly related series about simple parameterization, which you can read at sqlperformance.com/2022/03/sql-performance/…Paul White ♦ 1 min ago
And left you a comment as suggested
 
paul white: muppet wrangler
 
If I had a CV, that would be the first line
 
Oh give over...
 
12:19 PM
But when the comment gathers more upvotes than the answer, it will be automatically merged.
 
@Charlieface No pleasing some people 😋
Looks like chat's open again
 
i'm out of practice bouncing apparently
 
Use it or lose it I guess
 
@PaulWhite It's not open again, you just have SNAPSHOT still on and you haven't committed yet
 
COMMIT WORK;
 
12:23 PM
i'm gonna turn this chat around if you don't stop fighting
etc.
(dad voice)
 
See you do remember the basics
 
That's a good trick
 
Google is another company with too much money and spare time
 
another?
 
12:24 PM
Microsoft - renaming docs etc.
Stack Overflow Inc - pointless tweaks to UI colours
 
how do i become a company with too much money
 
you start with a good SEO
 
i'm cursed
 
@ErikDarling stop buying the latest Apple gadgets?
But yeah, SEO and graphic typos are right up there too
 
i don't think that annual occurrence is preventing me from being a billionaire
 
12:28 PM
Never will be with that sort of mindset
Do you think Elon Musk bought a new iPhone every year?!
 
you can't smash grimes with an old iphone paul
get a grip
 
OTOH Warren Buffet did finally buy an iPhone so
@ErikDarling Did you buy the phone outright, or did it come as part of a bundle?
Just curious
 
@PaulWhite i have t-mobile for a carrier and have a trade in credit/monthly payment plan for new phones with them.
i did not get the 1tb model though, just 128gb.
 
From a link in an email I received this week. They do not know their customers.
@ErikDarling Thanks. Do they offer a similar plan for the watches?
 
@PaulWhite yes, for any device practically
 
12:40 PM
same mailer
it's not pretty, is it
 
@PaulWhite Fewer schema stability locks allowing more operations to be ONLINE?
 
wat
hard to imagine how that might work
but maybe, who would know
 
I wish I could specify WAIT AT LOW PRIORITY for each operation, that requires a SCH-M
 
Are you not sufficiently excited about the shrinkdb improvement?
Good god man, be reasonable
 
@PaulWhite no, i've hated the look of smart watches though
 
12:47 PM
@ErikDarling I hear they make it easier to check what time it is
 
they also make it easier to check on what a giant nerd you are
 
🤣
 
Yesterday I saw a picture of someone who got burned by an overheating smartwatch battery during the night
seems like they are branding the nerds
 
about time
they're everywhere, hiding in plain sight sometimes
 
@PaulWhite I wanted to find the sqlbits presentation where I asked about it, but it's not on Youtube.
 
12:51 PM
@Zikato Don't take it personally, I'm sure you look just fine irl
Might wanna slip the iWatch off though
 
I live in the Czech Republic. I can't afford Apple products
 
@PaulWhite Slightly cheaper in Switzerland
 
well the swiss invented time
 
@JohnK.N. Yes well, your currency is popular
@Zikato Surely they're cheap in season? Or just raid a local orchard.
 
12:56 PM
Bargain
 
Compared to other prices.
 
And cars
 
Houses
Boats
 
Well houses are expensive. 1Mio+ for a house with 4 bedroom, kitchen, lounge, toilet, bathroom.
 
12:58 PM
1M is the average here (across the entire country, not my local area)
 
Are you talking about the same currency?
 
Zurich would be even more expensive.
 
@Zikato No, Switzerland has a real currency valued by others
NZ is approximately Zimbabwe
 
Nearly. CHF 1 = NZD 1.7
 
Must be CHuFfed with that
 
1:00 PM
I like going on holidays to Aotearoa.
 
1 NZD = 14.5 CZK
 
Not to the UK though. Bloody expensive.
 
@Zikato I had to look it up to find Koruna
 
Still better than HUF
 
Ah the good old Forint
Also Turkish Lira
 
1:05 PM
1usd=1.69nzd
no wonder wine is so cheap
 
freedom dividend
 
I'll HUF and I'll CHF and I'll blow your portfolio down!
 
the world is terrifying
 
1:32 PM
what method does ssms use to get execution plans?
is there a common api that profiler/xe/set commands use?
(i'm calling it an api because i have no idea what else to use there)
 
I think it's just SET STATISTICS XML ON
 
hm
what makes you think that
 
First one is with Actual Execution Plan on, second without
 
right, i'm curious about the method of retrieval
 
the server just sends an extra result set
how SSMS displays it is up to the app
 
1:40 PM
I guess it's hardcoded for that result set
 
yeah it's a single-cell xml result with a special name
 
They probably do it similarly in ADS which is on GitHub.
 
timeforthat.gif
i was writing a quick post about how ssms should have filtering for when you enable actual execution plans the way that xe and profiler do
but i wasn't sure if it retrieved the results differently
where that wouldn't be possible
 
Interesting. If I do SET STATISTICS XML ON in ADS, it shows both in the result set and in the Query plan tab
 
that's not a bug don't worry
 
1:47 PM
Well, it's consistent with pressing the Enable Actual Plan button. That also shows the plan in both places.
 
Paul is correct, as usual
 
If you choose to include the actual query, SSMS will first execute set statistics xml on on the session, then execute the query. When it gets back the result set, if any, it'll look for an xml result set with a column named "Microsoft SQL Server 2005 XML Showplan"
 
wild
 
1:50 PM
what if i start selecting other stuff aliased as 'Microsoft SQL Server 2005 XML Showplan'
will ssms confuse
will there be hax
 
everyone's done it at least once
 
It's aliased differently in ADS
but maybe that's one of the transformations
 
No one cares about ADS. Give it up.
4
 
me neither, I just want something for comparison
 
1:51 PM
@SeanGallardy-MostlyRetired it automatically converts the result to xml, hahaha
 
ADS got confused when I've aliased it as [Microsoft SQL Server 2005 XML Showplan]
 
ADS was confused to start with
 
ADS is AiDS anyway and worthless
 
@ErikDarling and if the xml validates against the showplan schema, clicking on it gives you a graphical plan; otherwise, just xml
 
is that like
i wonder
 
1:56 PM
There are other special column names like XML_F52E2B61-18A1-11d1-B105-00805F49916B
 
heh
sort like processing-instruction
 
This also came up in Slack yesterday: The trailing whitespace within a quoted identifier is ignored (same as with string)
 
doesn't render well on fiddle: dbfiddle.uk/YsPHB1dS
 
Looks sus
 
00:00 - 14:0014:00 - 00:00

« first day (4277 days earlier)      last day (591 days later) »