« first day (4977 days earlier)      last day (115 days later) » 

06:54
Wordle 1,158 4/6*

⬛⬛⬛⬛🟨
⬛⬛⬛🟨🟨
⬛🟩🟨🟩🟨
🟩🟩🟩🟩🟩
07:44
Wife & I both have Covid-19 for the first time
She's a lot sicker than I am. I just have a slightly sore throat and a bit of a headache, so far
07:57
Get better soon, guys.
08:35
Sister and brother-in-law caught it last year - they were crippled for a week!
Éirí go maith go luath!
Feel better soon
@Criggie Yeah, I always thought that banner was odd. Still, that's what it says. Nothing about an exemption for legitimate user questions or the information being available elsewhere. Maybe it's historical, idk.
I initially assumed the screenshot was from dba.stackexchange.com/help/privileges/site-analytics, which is granted at 25,000 rep here.
No big deal, I was just surprised.
 
1 hour later…
09:45
I'm always astonsihed by how much data can be weaseled out of SEDE
databases are amazing, aren't they
Internet Archive seems offline
 
2 hours later…
11:28
@PaulWhite oh no do you have enough gin?
Wordle 1.158 4/6*

⬛⬛⬛⬛🟨
⬛⬛🟨⬛⬛
🟨⬛⬛🟨🟨
🟩🟩🟩🟩🟩
@ErikDarling always!
Identity columns are just super annoying. Why are they so popular
@PaulWhite Get well soon.
11:40
Thanks. It's a minor annoyance for me at this stage
First illness of any kind since well before C19 arrived on the scene
I'd almost forgotten what it was like
I've had it four times. And the last time (September 2023) it feels like it left something in my system. Been at 60-80% performance since.
I was honestly hoping to never experience it. Ah well
No longer a NOVID
Though I haven't actually tested positive yet (wife has)
12:07
@JohnK.N. Sorry to hear that, that sounds rough.
@PaulWhite have you seen what else people do instead
@ErikDarling What's really worse though? Uniqueidentifier? Sequence?
Some massive natural key?
I did notice something new today though:
INSERT (c1, c2) VALUES (DEFAULT, 1) where c1 is a column with the identity property fails locally but works with a linked server.
I don't suppose it's at all useful to anyone, but it is a thing
@PaulWhite man who wrote a a blog post about sequence tables asks what's really worse
i guess it's not worse if they use the code from that post though
Ok, so rolling your own identity is worse
I was sort of hoping to implicitly limit the discussion to sensible ideas
have we met
12:19
🤣
but no i don't have uuid bias, except that people usually botch that too
sequences are probably fine? i don't think i ever found them to be better than identity
the primary advantage for me is you can allocate a sequence value or range up front
along with avoiding edge case identity weirdnesses
Erik posted that a little while ago
fully denormalized now
12:25
About the only thing I like about identity is it is immutable
do you mean you can update a sequence referencing column or that you can alter the sequence object after it's in use?
former
I'd go so far as to say identity is most often technical debt
@PaulWhite Aw shucks.
It was on 𝕏, if memory serves
@PaulWhite if it's an integer, yeah
12:33
@ErikDarling Well, besides that there are just so many gotchas. They're easy to add in at the start but will bite you in increasingly subtle ways later on. Witness the number of questions about matching up identity values when loading data into tables in a structural relationship.
Never mind the remote server issues everyone is so well-versed on
3
A: Is it possible to update an existing table in a single statement, using the output of a MERGE statement?

Paul WhiteNot with a checked foreign key relationship, no. Nested DML doesn't work when the table is on either side of an enforced FK relationship. Note also that only an outer INSERT is permitted. Temporarily not checking the FK would almost work, but the identity on the child table presents another roadb...

so well versed
Just one example I happened to revisit recently ^
There are patterns to work around most things in most cases, but they're not universal and represent surprise learning for most people new to SQL Server
At some point we decided it was acceptable to use MERGE and OUTPUT into a table variable to map identity 'keys'.
But really the whole thing is ridiculous
More time is spent understanding and avoiding the technical limitations and sneaky gotchas than writing productive code
yeah
i still think back on this
DECLARE @T table (c1 integer PRIMARY KEY, c2 char(4) NULL);
DECLARE @A table (j nvarchar(max) NOT NULL);
INSERT @T (c1, c2) VALUES (1, 'abcd');

DELETE T
OUTPUT CA.j INTO @A
FROM @T AS T
CROSS APPLY
(
    SELECT T.*
    FOR JSON
        PATH,
        INCLUDE_NULL_VALUES,
        WITHOUT_ARRAY_WRAPPER
) AS CA (j)
WHERE
    c1 = 1;

SELECT *
FROM @A AS A;
It's hardly intuitive code is it
🍈 🌪️
> Note that as of SQL Server 2008 the results of the outer operation must be an INSERT-SELECT. That’s a rather frustrating limitation, and I really hope the SQL Server team loosens the restrictions in the next version of the product.
poor guy.
12:49
What's the context there? Or doesn't it matter
it's from the article you linked above
Oh is it ha ha
Jul 21 at 17:26, by Hannah Vernon
Jul 10 at 10:43, by Zikato
Apr 9, 2023 at 18:21, by Paul White
Reading comprehension being what it is these days
They never did develop that feature
It was a reasonable hope at the time
> By Adam Machanic - August 24, 2009
i suppose that was before microsoft got a reputation for bailing on everything
12:55
Before they really committed to it as a corporate vision, yeah
Almost that post's 15th birthday
Of course that method doesn't work against a remote server
Because MERGE doesn't
@JoshDarnell Thanks Josh
Never mind that the OUTPUT clause can produce rows even if the host statement encounters an error
that seems like it would be good for finding where errors occurred in statement
but i bet it's not
i wonder why microsoft stretched out cursor variable declaration and options the way they did
So much SQL Server development is coming up with a brilliant idea, implementing 80% of it, then hitting a product roadblock in some weird area
@ErikDarling Interns
It's annoying it can't be one DECLARE
13:02
paying the price for close/deallocate laziness
DECLARE @ID int;
SELECT @ID=MAX(ID)+1 FROM TABLE;
INSERT INTO TABLE (@ID, Text, BLA)
VALUES (@ID, 'Text', 'BLA BLA');
Seen in the wild.
all the time
> You cannot specify scroll locking on a cursor that contains a remote table.
So random
> a network cable is unplugged
13:07
> A remote table cannot be used as a DML target in a statement which includes an OUTPUT clause or a nested DML statement.
> Remote table-valued function calls are not allowed.
> The target of a MERGE statement cannot be a remote table, a remote view, or a view over remote tables.
> Remote tables are not supported in MATCH clauses.
> Remote tables are not updatable. Updatable keyset-driven cursors on remote tables require a transaction with the REPEATABLE_READ or SERIALIZABLE isolation level spanning the cursor.
Boggling
truly
i was trying to figure out at what age i stopped worrying about oversleeping
been a long time
these days, I worry more about undersleeping
workplaces are the funniest for timings like that
like, you absolutely must not be late for work or leave early
but fuck about and time-waste as much as you can get away with once you're there
just be present bro
13:15
exactly
nvm about getting shit done
I bet the team working on adding a new tag at SO is never l8 for work
and how about software running on remote worker's machines to log when they're there and looking at the screen or not
encourages exactly the wrong sort of behaviour
i'd like to think i'll never have to deal with that again
Same. It's soul-destroying
i really don't understand the point of email reactions
a few times a week i'll get a "microsoft outlook reaction digest" email telling me that someone gave my response a thumbs up
i'd rather not know
Ah. An Outlook-specific thing is it
Sounds like u need a compulsory team building exercise
Or a corporate culture indoctrination session
Name something more trivial than email reactions
so tags
this morning i learned that the $30 a month i make from youtube memberships is subject to a 30% tax withholding
is this communism
I have to say tax sounds like a capitalist thing
But I'm not an expert
it's not a free market if there are taxes obviously
I hope they keep that 30% nice and safe 4 u
13:31
Isn't that coincidentally the same r8 the Apple app store charges
Seems like someone has decided the masses will tolerate 30% deductions without rioting
it's worse in europe
ofc
isn't everything yeah
Isn't communism more like: take from the peasants (workers) and distribute unevenly between family (30%), friends (30%), politicians (30%) and the citizens (10%)?
I don't think anyone really knows what communism is
It's only really in the headlines because of US elections
based on observational data, i think politicians wind up with 90%
13:34
There doesn't seem to be a working model.
Yeah, I don't think anyone really knows what a working model would look like
But that's ok. There are plenty of things we don't understand yet
Meanwhile, it gives people something to argue strongly about
People love to argue about labels (and tags)
thankfully we have the internet to expedite the process
and Wikipedia to light the way
Oh, the Internet Archive is back 🥳
what were you archiving
Fixing a broken link in a Q & A
13:41
such dedication
where do you muster it
The gin bottle
a good muster point
But no, making things slightly better is its own reward
The gin-ny in a bottle
Thank you for reviewing 20 close votes today; come back in 10 hours to continue reviewing.
i'm looking at an orm query with 358 parameters passed to it
violence was chosen
13:50
Ah yes, close votes review.
The network is built on the basis of free labo(u)r.
Perhaps SO is communist.
---
@ErikDarling Isn't the limit something like 2100?
I think I only know that because someone hit it
What were they up to, I wonder
Oh, maybe it was an EF thing
Long IN lists or something
i thought it was 8000 for sql server
but i'm probably misremembering something
> Parameters per stored procedure - 2,100
Parameters per user-defined function - 2,100
i wonder why 2100
what happened at 2101
It's not even 2100 as far as I can tell it is 2,099 i.e. < 2100 not <= 2100
Anyway, the query optimizer ran out of resources errors
14:08
@ErikDarling dear lord
this whole thing is quite a mess
14:29
This seems to be latest on EF parameterization: github.com/dotnet/efcore/issues/34347
> In 8.0, we changed the default translation for parameterized lists from constantization to parameterization (e.g. with OPENJSON); this is better for plan/query caching (single SQL), but can produce bad query plans (#32394). For 9, we're adding extensive means to control the parameterization vs. constantization behavior, both at the global context options level (#34344) and at the per-collection level (EF.Constant, EF.Parameter (#34345)).

For 10, we plan to reexamine what the default should be. The problem with the current full parameterization, is that the bad plans it occasionally cause
sql server makes some real bad choices
boy howdy
THIS OPTIMIZER SOMETIMES
I learned that optimize for adhoc workloads is a global server option
Someone should make a database scoped version eh
should be removed from the product
> In addition, the main problem with constantization is caused by SQL Server's behavior to cache query plans on the very first execution. Other databases do not typically do this...
It must be difficult to try to support every known database
it's difficult enough to support just one
14:35
especially when using SQL Server
-- Inline collection with parameters, with bucketization (optimization for Contains only):
SELECT * FROM foo WHERE x IN (@p1, @p2, @p3, @p3, @p3);
I wonder why they only did that for Contains
Anyway, I should stop pretending I care
People using EF experience pain. Well, good.
using EF is just admitting defeat before you've even entered the ring
Is that a towel or a white flag
a dainty hanky
using a crappy index: filter before lookup.
using a better index, filter well after lookup
thanks buddy
is it too late to play drums for motley crue
I hear OPENJSON is the answer
14:48
don't forget to close and deallocate your json
I've had variable success with that
15:07
Interesting to see Martin Smith in that EF issue discussion
leading with the company name
man he's been there a long time
jeez no one liked my avg dist from eol/lp request answer
@ErikDarling ?
Ask yourself, if MS worked at your place would u let him leave
no i'd smack my mom to keep him on
15:49
it's quite irksome that i still need to increment in this case
DECLARE
    @i integer = 1,
    @e integer =
    (
        SELECT
            MAX(d.database_id)
        FROM sys.databases AS d
    ),
    @s nvarchar(MAX) = N'';

SET @s = N'
SELECT TOP (1)
    @i = d.database_id
FROM sys.databases AS d
WHERE d.database_id >= @i
ORDER BY
    d.database_id;';

WHILE
    @i <= @e
BEGIN
    EXEC sys.sp_executesql
        @s,
      N'@i integer OUTPUT',
        @i OUTPUT;

    RAISERROR(N'%i of %i', 0, 1, @i, @e) WITH NOWAIT;

    SELECT
        @i += 1
END;
oh wait nevermind
DECLARE
    @i integer = 0,
    @e integer =
    (
        SELECT
            MAX(d.database_id)
        FROM sys.databases AS d
    ),
    @s nvarchar(MAX) = N'';

SET @s = N'
SELECT TOP (1)
    @i = d.database_id
FROM sys.databases AS d
WHERE d.database_id > @i
ORDER BY
    d.database_id;';

WHILE
    @i < @e
BEGIN
    EXEC sys.sp_executesql
        @s,
      N'@i integer OUTPUT',
        @i OUTPUT;

    RAISERROR(N'%i of %i', 0, 1, @i, @e) WITH NOWAIT;

END;
crisis averted
16:21
Holy transcript code & scrollbars
16:36
DECLARE
    @i integer = 0,
    @c CURSOR;

SET @c = CURSOR LOCAL FORWARD_ONLY STATIC READ_ONLY FOR
    SELECT d.database_id
    FROM sys.databases AS d
    ORDER BY d.database_id;

OPEN @c;

WHILE 1 = 1
BEGIN
    FETCH NEXT FROM @c INTO @i;
    IF @@FETCH_STATUS = -1 BREAK;
    RAISERROR(N'%i of %i', 0, 1, @i, @@CURSOR_ROWS) WITH NOWAIT;
END;
you and your cursor options
how do you even decide
Well, LOCAL FORWARD_ONLY STATIC READ_ONLY is pretty standard
For a point in time view of the data that I will read sequentially all the way to the end, once
i would sponsor a blog post about which cursor options to use when
it's impossible for the average person to keep str8
Sounds like the sort of engagement b8 Ozar would write
well no, because that would require knowing what you're talking about with cursors
16:50
That's never stopped him b4
I read this just yesterday: brentozar.com/archive/2021/07/…
> In this query, SQL Server believes that LOTS of users are going to match, so it decides to just go start fetching rows from the Posts table across the network.
I should have stopped reading right there
quite the yikes
It works for him, I guess
CASE WHEN (0) IS NULL OR (0)<(0) THEN (0) ELSE (0) END
Is that a TOP expression from somewhere?
window function plan
WITH
    Comments AS
(
    SELECT
        n = ROW_NUMBER() OVER
        (
            ORDER BY
                c.CreationDate
        )
    FROM dbo.Comments AS c
)
SELECT
    c.*
FROM Comments AS c
WHERE c.n = 0
OPTION
(
    USE HINT('QUERY_OPTIMIZER_COMPATIBILITY_LEVEL_140')
);
16:59
Oh yeah filtering on ROW_NUMBER = 0
The general idea being to stop reading after the required number of rows
Makes more sense in a query with c.n = <some non-zero value or a variable>
No point reading past row 5 of 364892086062 if you want row number 5
i like what happens to the plan when you change it to WHERE c.n > 2147483647
nifty little serial zone
Don't you see that for any greater than comparison?
well yes but i chose a high number to eliminate returned rows
If you like a parallel row mode window function, you'll need a PARTITION BY
But yeah
A single Filter in a parallel zone is one of the weirder choices SQL Server makes sometimes
@ErikDarling Vague question. You had a trick with a table variable and EXEC or something like that. Do you have a post where you use it?
It was some horrible abuse but I can't remember the detail
17:16
oh yeah hang on
i apologize for the query formatting in that post
it was before i saw the light
Yes! That was it, thanks
guess what didn't actually take 17 seconds, but instead took about 8 seconds
Death is too good for him
17:35
what did you need that post for anyway
some other linked server thing
17:46
No, it was just something I half-remembered the other day and it was bugging me in the background
I was thinking about tricks with sp_executesql
i remember you making fun of parameter table scans after that for some reason
was also heartbroken when it made a query slower for someone
truly gutted
basically dead
Happens somewhere magick, I hear
18:11
i've never gotten a better explanation
18:42
huh
well this is weird
serial batch mode plan, no sort
parallel batch mode plan, sort
both reading from the same index with the windowing function columns aligned
18:59
> Currently, SQL Server isn’t able to pull the data ordered from a B-tree index with a parallel scan and distribute it gradually and dynamically over worker threads like what would be optimal for the Window Aggregate operator without a mediator like a batch Sort operator.
> Doing it without a mediator would require more work on Microsoft’s part in the SQL Server engine, and hopefully we will see such support in the future. For now, the optimizer has to make a choice between a serial plan without a Sort operator and a parallel plan with one.
@ErikDarling It's an annoying limitation ^
> Itzik Ben-Gan June 1, 2016
Guess what hasn't been improved since then
...
> An error occurred while executing batch. Error message is: Error creating window handle.
Time to restart SSMS
Actually, I might as well do that postponed Windows Update while I'm at it
Not too bad. Just one nag from Edge to use Microsoft recommended browser settings on Edge restart
NO I WILL NOT USE BING
Now I'll just listen to the jet engines taking off for half an hour as the .NET Runtime Optimisation Service does its thing
Oh, and two instances of Teams to uninstall yet again
Such a rude product
19:18
how did you get two
@PaulWhite thanks.
@ErikDarling First time. Regular Teams and Teams (personal)
I don't know how either of them got installed
So rude
At least it's quick to uninstall
Imagine that being the best review you ever got for your product
i'm sure they're used to it
optimize for uninstall workloads
@PaulWhite Drives me nuts.
19:28
Do you not like your .NET code optimised
 
1 hour later…
21:13
@ErikDarling Boeing 777X - not all they're cracked up to be!
21:33
No, just cracked up
21:53
Woe is them
@ErikDarling Seems buggy
22:16
@ErikDarling That was an interesting one, solved it last friday. There's a fix incoming.

« first day (4977 days earlier)      last day (115 days later) »