« first day (4879 days earlier)      last day (286 days later) » 

00:05
Well it sucks but it’s not anything I think about too much
> Roly-poly fish heads are never seen drinking cappuccino
In Italian restaurants with Oriental women
That ends up on my mind way more often
Difficult to imagine anything more simply true
 
6 hours later…
05:48
morning
Wordle 1,060 4/6*

⬛⬛🟩⬛⬛
⬛⬛🟩⬛⬛
🟨⬛🟩🟨⬛
🟩🟩🟩🟩🟩
 
1 hour later…
06:50
Wordle 1,060 5/6*

⬜🟨⬜⬜⬜
⬜⬜🟩⬜⬜
⬜⬜🟩⬜⬜
🟨⬜🟩⬜⬜
🟩🟩🟩🟩🟩
 
3 hours later…
09:34
@Vérace It was letter 'N'
Wordle 1,060 4/6*

🟨⬛⬛⬛⬛
⬛⬛🟩🟩⬛
⬛⬛🟩🟩⬛
🟩🟩🟩🟩🟩
frog sitting on a lilypad looking at a fly
2
 
2 hours later…
11:11
A chairde - Morning all!
@Zikato So you had a 'C' and an 'N' somewhere and your second guess was correct - pretty good!
Don't get the "frog sitting on a lilypad looking at a fly"?
Wordle 1,060 4/6

🟨⬛🟩⬛⬛
⬛⬛⬛⬛🟩
⬛⬛🟩🟨🟩
🟩🟩🟩🟩🟩
11:32
God bless your imagination! :-)
If you squint enough, everything looks like a frog
If I drink enough, everything looks like a frog!
Especially the girls!
11:49
That’s because Irish girls inherit faces from their fathers
12:02
@ErikDarling That's why Irish girls are always "Darling wee lassies" to their fathers...
No maid I've seen like the fair cailín that I met in the County Down
:65651222 I'm expecting an apology anytime soon. I did properly Czech it after all :)
@Zikato - note: retracted - screen too small! :-)
@PeterVandivier detach + hex editor?
Or my eyes are too old?
12:38
did @JohnK.N. just discover joins
perhaps a shower curtain that explains them with venn diagrams would be helpful in this journey
@MichaelGreen hellmo.gif
@ErikDarling nope. I was just wondering why a JOIN occurs without any JOIN predicate.
it's basic join reordering
yeah, but the tables FirstNames and LastNames have no reference to each other.
so? they're both joined to personsanon. it's a commutative arrangement.
if you add an option(force order) hint you'll see a plan with a higher estimated cost that retains join order as written.
13:03
@ErikDarling Am I right if I deduce that the JOIN results in a list of elements that are just passed on to the next JOIN
and thanks for the edit
essentially, yes. i don't have a copy of AW to mess with things. i tried with the displayname column from my SO database, but i can't repro your exact plan.
13:20
I broke dbfiddle.uk while trying to produce a repro
> Msg 1101 Level 17 State 12 Line 1
Could not allocate a new page for database 'fiddle_18db0a5382d849b2a8cf9f9addf716f8' because of insufficient disk space in filegroup 'PRIMARY'. Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
Doesn't work on dbfiddle with just 200 first and 200 last names. It then produces an execution plan similar to what I would expect.
|--Sort(ORDER BY:([ln].[LastName] ASC, [fn].[FirstName] ASC))
|--Hash Match(Inner Join, HASH:([ln].[LastNameID])=([pa].[LastNameID]))
|--Clustered Index Seek(OBJECT:([fiddle_7cc263853e234985900e9507268174e3].[dbo].[LastNames].[CIX_LastNames_LastName] AS [ln]), SEEK:([ln].[LastName] >= 'Åþ' AND [ln].[LastName] < 'C'), WHERE:([fiddle_7cc263853e234985900e9507268174e3].[dbo].[LastNames].[LastName] as [ln].[LastName] like 'B%') ORDERED FORWARD)
|--Hash Match(Inner Join, HASH:([fn].[FirstNameID])=([pa].[FirstNameID]))
13:36
> OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
They seem v excited
it's here!!!
🥳🎈
I imagine PC looking at their PKI AI meter and wondering why folks ain't clicking
Wordle 1,060 4/6*

⬛🟨⬛⬛⬛
⬛⬛🟩🟨⬛
🟨⬛🟩🟩⬛
🟩🟩🟩🟩🟩
That was a brutal wordle today
Heaps of green blood on the floor
@JohnK.N. Please consult StarJoinInfo in Execution Plans
Especially the section, "Cartesian Products and Multi-Column Index Lookup"
I noticed the same operator NESTED LOOPS with NO JOIN PREDICATE.
If I remove the column pa.Info2 from the select statement, then the Execution Plan reverts back to "normal" behaviour.
13:56
it's almost like it's making cost-based choices
weird huh
Is this like having a built-in DWH feature in the OLTP database?
Ah yes....
> Although intended to speed up selective star (and snowflake) schema queries in data warehousing, the optimizer may apply these techniques wherever it detects a suitable set of tables and joins. The heuristics used to detect star queries are quite broad, so you may encounter plan shapes with StarJoinInfo structures in just about any type of database.
> Any table of a reasonable size (say 100 pages or more) with references to smaller (dimension-like) tables is a potential candidate for these optimizations (note that explicit foreign keys are not required).
@ErikDarling okay, I understand.
@PaulWhite Thank you for the article.
It's only surprising the first time you encounter it
After that, you start to recognise the patterns and check joins for StarJoinInfo
I don't know why it isn't present on the cartesian product. An oversight, perhaps.
I get asked about it about once a year
So that's 2024 covered
@HannahVernon I clicked on it, but only to dismiss the banner so it never comes back
@ErikDarling OPTION (LOOP JOIN, MAXDOP 1) was needed for me
14:19
Appreciate your condensed answer..
I've just discovered that using the original cardinality estimator is an easy way to get your plan without hints
The estimates are much better
14:43
i tried that locally, but it didn't pan out
Having AdventureWorks also helps 😀
 
2 hours later…
16:43
helps with what
being a dork
17:01
you have too nice of a laptop collection to keep AW around
I keep it because I have some old demo that use it
Also, it takes no space
an insult to the hardware
Windows Update is committed to helping the environment
AdventureWorks2022 is the latest and greatest
I bet Erland still has Northwind
17:19
pubs
i was asked by a client to write this: gist.github.com/erikdarlingdata/…
dunno how i feel about it
Well, if it's what they need...
Getting close to the connections limit are they?
Or just don't like having idle sessions around?
It's a fairly common thing.
I know what you mean though. It's not really a solution to whatever their real problem is, and it's not gr8 for system stability. Perhaps they'll abandon it after they encounter their first zombie session that requires a system retstart.
I can't help but mention that cursor doesn't need to be SCROLL and won't be DYNAMIC.
17:35
is Top Microsoft Man still with us or did he opt out finally
Probably trapped under a 3lb weight at the gym
also, I have a Distributed Availability Group distributing data to a Distributed Availability Group that distributes data to a Distributed Availability Group.
@PaulWhite hah that makes for a funny mental image
Even better on the security cam
I've been watching him struggle for hours
17:37
your brain is awesome
@PaulWhite i just copied in the cursor options from loghunter that you suggested
perhaps a blog series on how cursors work would be of use to the world
I keep coming here for the cursor options
also Microsoft Groove Music thinks Led Zeppelin is "Metal & Hard Rock"
some of it is "hard rock" i guess
have we stopped calling it classic rock?
is it now legacy rock?
I mean Classic is where I'd go with it
certainly not in any universe is it metal though
> fetch: The fetch type first cannot be used with forward only cursors.
paul lying to me
how dare
i want my money back
17:47
I feel like its fairly likely that you didn't explain requirements properly as opposed to Paul recommending something that doesn't work. Just a guess.
no one is perfect, and perhaps its just the wine making Paul slip
he saw the code
full of comments
transcript for details, 'natch
I've been way to busy lately to read the transcript unfortunately
Or write the transcript it seems
17:52
@ErikDarling Yes, but you don't need FIRST
If you open a cursor and fetch, you get the first row
The only thing adding FIRST does for you there is to require a SCROLL cursor
When you don't need one. You're starting at the beginning and fetching rows one by one forward-only
DECLARE
    killer
CURSOR
    LOCAL
    FORWARD_ONLY
    STATIC
    READ_ONLY
FOR
SELECT
    S.[session_id],
    S.[host_name],
    S.login_name,
    S.[program_name],
    S.last_request_end_time,
    duration_seconds =
        DATEDIFF(SECOND, S.last_request_end_time, GETDATE()),
    last_executed_query =
        LEFT(IB.event_info, 4000),
    kill_cmd =
        N'KILL ' + CONVERT(nvarchar(5), S.[session_id]) + N';'
FROM sys.dm_exec_sessions AS S
JOIN sys.dm_tran_session_transactions AS ST
    ON ST.[session_id] = S.[session_id]
For example.
Anyway, this isn't codereview.stackexchange.com. I only mention it because cursors are topical.
The Transcript Thanks You
Besides, asking what kind of cursor is best is like asking what kind of join is best
@PaulWhite I do for what I copy and pasted 😃
Donk donk
I've already had John using CROSS APPLY when CROSS JOIN was correct today.
Patience is thin.
18:09
That does bring to my attention that the cursor select should have an order by on it though
Thanks etc for your non-code review
CF will be here shortly to suggest XACT_ABORT
I prefer to write my cursors with a single FETCH but I suppose it's a matter of preference
Someone's failing over chat again
FETCH killer; is an awesome line of T-SQL btw
FETCH NEXT FROM killer; doesn't have quite the same ring to it
I concur.
@PaulWhite the first time I saw you do that I almost fell over. Now it's the standard approach, most of the time.
so.much.nicer.
Jun 18, 2023 at 10:30, by Charlieface
Why does all cursor code look like
FETCH NEXT ...
WHILE @@FETCH_STATUS = 0
BEGIN
....
FETCH NEXT ...
END
and not like this:
WHILE 1=1
BEGIN
FETCH NEXT ...
IF @@FETCH_STATUS <> 0 BREAK;
....
END
I was thinking of this style of cursor myself:
DECLARE @cur CURSOR;
DECLARE @rows int;
DECLARE @db_name sysname;

SET @cur = CURSOR LOCAL FORWARD_ONLY STATIC READ_ONLY
FOR
SELECT [d].[name]
FROM [sys].[databases] [d]
ORDER BY [d].[name];

OPEN @cur;
SET @rows = @@CURSOR_ROWS;
WHILE @rows > 0
BEGIN
    FETCH NEXT FROM @cur INTO @db_name;
    PRINT @db_name;
    SET @rows -= 1;
END;
CLOSE @cur;
Yes, that's a good choice when the cursor has fixed membership
I remember the occasion now
18:23
a dynamic cursor not so much
probably 99% of the cursor things I do are static, read only, forward only cursors
It's a common usage.
I like the SET @rows -= 1; perhaps a bit more than I should.
what am i talking about, the entire thing is just elegant.
and not a leading comma in sight
@rows--; would be better
But then we'd be programmers, I suppose
18:26
@PaulWhite you’re gonna have to show me that trick
Can't be that hard to hire a hitman in NYC surely
I prefer FETCH NEXT myself in the same way that I prefer INNER JOIN to just JOIN.
Same, usually
but certainly FETCH Killer is awesome, as in "say what again"
Inner join won’t win you code gold
Inner join won’t win you code golf
18:29
Not with that capitalisation
Chat having a weird time today
retry or ignore?
Double messages after edits
Lots of retrying earlier
Too much of a hassle to show mobile
Yeah, I've had the same
18:34
I feel weirded out that this didn't get any attempt at an answer, nor even a comment. I thought XE was the thing.
I swear they're testing cloud shenanigans on chat
@HannahVernon This site needs some sort of way to attract attention to a question, perhaps in exchange for a reward of some kind. Perhaps suggest it on meta, see if it gets any traction
I’d put a bounty on that
I hadn't seen it b4
a bounty would be au fait I suppose
18:37
Or just ping Zikato and be done with it
I'm too tired to even read it rn
Let us know if you need any help with the ping
Answer the XE question? And get the fruit of my labour exploited by the Stack AIflow?
@PaulWhite whenever there is a picture of Sean Connery, I get pinged for some reason
Did you have to double-czech it wasn't your president?
I sang the anthem anyway. Just to be sure
18:44
Can't be 2 careful
@PaulWhite you okay buddy? You’ve been complaining about being tired a lot lately.
Any North America based Postgres people? Starting salary 190k.
19:02
I wonder how green you have to be to work there
@ErikDarling Well, it's often v early in the morning when you hear it
did you just have 40 winks
I went to put the washing up away
I suppose I’m used to you failing over to a clone
ah yeah
I should look into getting some more of those
19:09
> Participate in on-call rotation to ensure 24/7 availability
Hard pass
Aug 2, 2017 at 15:54, by Paul White
I have several clones; it kinda depends which one is on duty
@PaulWhite I was typing fast.
@HannahVernon I'll have a look
sweet, @Zik - you're the best
Sep 18, 2015 at 18:49, by Max Vernon
@Zane Paul never sleeps. He leaves that to his clone.
I wonder if that'll wake the dead
@mustaccio i know people who work there. the on-call rotation is not overbearing, but i understand if any at all is pass-worthy.
> Peter Vandivier viewed your profile. See all views.
am i being poached
19:15
There are no based Postgres people
blue pilled it seems
19:39
@HannahVernon omg, what a nerd snipe
@Zikato 😁
I tried and tried to figure it out but couldn't get anywhere with it
to me its unanswerable
OMG I h8 GUID byte reordering
@HannahVernon i don't even understand the question tbh
ok, you could just not fully qualify the things and it would work, but I wonder why
I mean, it's better to fully qualify your intent, as a way of eliminating the unexpected.
but in this case, the WHERE clause items are unqualifiable as far as I can see. I certainly expect to be proven wrong on that, because there must be a reason.
@PaulWhite someones reverse engineering
@HannahVernon is it actually generating any unexpected events?
19:51
no, but it might
sometimes the only way to adjust filtering correctly is to actually receive unexpected data and make changes accordingly
especially with extended events
i went through a lot of that while building the humanevents code
sometimes you need to lead me down the garden path but usually I get there
@ErikDarling it seems like a lot of work went into that
yes it was quite a bit of labor
i don't even use most of it
some people do, which is cool
20:01
this is the bit that annoys me most:
/* this is the database name where the BACKUP operation took place, not the database being backed up. */
    [CE79811F-1A80-40E1-8F5D-7445A3F375E7].[sqlserver].[database_name] = N'maintenance'
/* this is the name of the database that was backed up */
AND [database_name] = N'<database_of_interest>'
There are two different [database_name] predicates that are different
my brain needs to have AND [database_name] = N'<database_of_interest>' to be fully qualified just like the other reference to [database_name]
I mean it doesn't need to use the damn GUID, just for clarity
I used the GUID because there are three different packages called [sqlserver]
I've tried to answer
thanks - much appreciated. It sure is curious that it doesn't work even though it seems like it should. Probably a bug I'm guessing.
WORKING AS INTENDED
GO AWAY
 
1 hour later…
21:35
@HannahVernon Is this the sort of 'fully qualified' you had in mind?
CREATE EVENT SESSION [backup_finished]
ON SERVER
ADD EVENT sqlserver.backup_restore_progress_trace
(
    ACTION
    (
        sqlserver.client_app_name,
        sqlserver.client_hostname,
        sqlserver.[database_name],
        sqlserver.nt_username,
        sqlserver.server_principal_name,
        sqlserver.[session_id],
        sqlserver.sql_text
    )
    WHERE
    (
        (
            (
                (
                    (
                        [backup_restore_progress_trace].[database_name]=N'database of interest'
wow.
yes.
There is a guid for [backup_restore_progress_trace], which appears to be [92C4D441-5442-40D7-83D9-3B0250920361] internally, but you can't use it in T-SQL.
Super awesome that you can't use the GUID. I wonder why. Thanks for spending your time looking Paul.
I was mostly curious about finding the GUID. I don't think using them adds much readability
no it definitely doesn't make it more readable. I was using them just to be as specific as I could when I was trying to figure out what names to use in the WHERE clause.
I was surprised to see three different modules expose items in [sqlserver]
21:40
There are more than you listed, but they're not very interesting
I apologise for the unnecessary parentheses, but I started from the SSMS GUI
no worries 😁
this is what I wanted:
[backup_restore_progress_trace].[database_name]=N'maintenance'
yeah, I know 😉
its funny because it seems blindingly obvious now
I'm still not convinced I got the database names the right way around
you didn't but thats ok
the important thing is there is now a way to distinguish each of them
21:45
fixed now?
now all I need to do is convince Microsoft they need to finish the Service Broker target for Extended Events
@PaulWhite perfect
I love that someone decided the way to distinguish them in the GUI is to be unhelpful:
thanks @Zik for the screenshot, btw
@PaulWhite I was literally posting an "idea" to the Feedback Azure site when you posted that beautiful snippet.
I put it in an answer briefly because it deserves to be on main as well as chat I think
yes, thank you for that. It's certainly helpful only now I have to choose between a well researched sensible answer provided by the inimical @Zik or the answer I was hoping for.
You can also write [D5149520-6282-11DE-8A39-0800200C9A66].[backup_restore_progress_trace].[database_name]=N'database_of_interest' if you really want to
I'm not a huge fan of using the module GUID but it seems to be the only real way to absolutely distinguish each one.
22:00
Would you prefer XE_SQLMIN_MODULE_GUID.[backup_restore_progress_trace].[database_name]=N'database_of_interest'
it would be nicer if you could use the module name, i.e. [sqlmin].[backup_restore_progress_trace]
is XE_SQLMIN_MODULE_GUID a constant or something?
how did you find the correct guid?
@HannahVernon Yeah, but you can write anything you like there so long as it can be resolved uniquely otherwise e.g. [PENGUIN].[backup_restore_progress_trace].[database_name]
So, you can write [sqlmin] if you like, but it doesn't do anything
22:06
cray cray
parser mysteries
@Zikato It's sqlmin!XeSqlPkg::backup_restore_progress_trace::sm_guid
It's like tempdb.BananaPenguin.#temp
I just snorted
22:22
This room is full of heroes

« first day (4879 days earlier)      last day (286 days later) »