« first day (3339 days earlier)      last day (1515 days later) » 

4:38 AM
was there ever any technical publicity followup around OPTIMIZE_FOR_SEQUENTIAL_KEY ?
i feel like that was the hotness for a very brief second and then it just stopped being talked about
 
5:23 AM
yea, that's back from august though
i may have seen that when it came out but it's a nice refresher, ty
i think the thing i'm feeling salty i never got is a write up on what the tradeoff(s) are (if any)
like... when Erik was asking "if there's no downside, then why isn't it on by default (¿in Azure?)"
can't remember his exact sentiment, but something like that
 
> Despite these waits, you should be able to achieve much better throughput, and scale to a much higher number of concurrent threads, without hitting the proverbial cliff. If you're not experiencing the convoy phenomenon in your workload, you may not see a huge benefit from this option, and you may even see a slight degradation in performance due to the new flow control waits.
 
🤷‍♂️ fair enough
 
Also
> Keep in mind that this flow control is not going to improve individual insert latency, in fact quite the opposite. Think of it like the traffic lights on a highway on-ramp – the cars coming onto the highway are going to wait longer before they are allowed to enter. It’s going to make them a bit slower than normal, but the result is the traffic keeps moving at a constant (albeit slower) rate instead of piling up.
> Our initial testing shows up to 30% improvement in throughput on some workloads, but of course your mileage may vary.
 
i guess i just have a hard time imagining when setting that option a low-concurrency index would cause enough additional wait to offset the upside in allowing it to become high-concurrency on a whim "more safer"
feels like it's a risk management choice on MS end, and i assume that by default it's fine
 
If they turn it on by default, it will hurt someone's workload and they will be unhappy.
There will already be enough people turning it on simply because it has OPTIMIZE in the name, and who doesn't like optimized.
 
5:33 AM
although it'd be fun to have some idea of the numbers where you enable it on 1,000 low-concurrency tables and then that new flow control wait actual does make a meaningful impact in profiling
 
Yes someone should blog about that maybe.
 
they should
oh them
 
I wonder if fixed numbers are possible, or if it depends on other things like hardware.
 
how do you say "It always depends" in latin? 🤔
wanna get that put on some heraldry
 
heh yeah
It's a funny thing in some ways because you'd think the go-to solution would be Hekaton.
At least from a marketing POV.
> This problem can be identified by many threads waiting with a wait type of PAGELATCH_xx on the same page resource in a user database.
Perhaps they'll add automatic tuning for that on Azure at some stage.
> The best way to address the problem is to test the various options and choose the one that works best for your application and environment.
That's a cop-out obviously, but hard to argue with as a general principle.
 
5:41 AM
do you know if you can toggle the setting on/off on the fly without a rebuild? can't seem to figure out the syntax
 
good question, no I don't know
 
intuitively, i sort of assume you could - not knowing more about how it works under the hood
if you can i'm imagining that deferred activation - say... profiling your instance and setting it on when you detect a spike in pagelatch tied to a single problematic index that lasts for X minutes might be a thing to consider
if you can't, then nbd
but a nice option perhaps that gets you out of some of the restrictions of hekaton
depending on whether you need a schema stability lock or not or... etc etc
 
You can:
 
which you probably would
 
ALTER INDEX <index_name>
ON <schema.object>
SET (OPTIMIZE_FOR_SEQUENTIAL_KEY = ON);
 
5:47 AM
guess i forgot you can target a PK with an alter index statement like that
or rather that the underlying index shares the name
 
right
 
 
1 hour later…
7:08 AM
@PeterVandivier I can think of a way or two to make these updates in Postgres similar to SQL Server's way.
 
7:33 AM
Morning
 
@PeterVandivier this for example, would be a sl;ight variation on the CTE method you use:
WITH cte AS (
	SELECT
           f.id,     -- Adding the PK/UQ of the table you want to update
	    f.a,      -- you don't need this line now
	    b.a AS new_a,
	    '?' AS something_else
	FROM foo f
	JOIN bar b ON b.id = f.id
)
UPDATE foo
SET    a = a || something_else
FROM cte
WHERE cte.id = foo.id ;
Keeping the final UPDATE as simple as possible.
It's also easy to recognize if the update is deterministic or not.
Does the CTE have (id) as a unique key? Or it may produce two rows with same id?
Neither SQL Server nor Postgres can recognize this on their own. yet.
 
7:49 AM
Yea, I may end up going with that
Feels a bit hypocritical telling the dev not to use the arguably simpler syntax though
Might need to surrender that particular hill
 
I guess it depends on how much you trust them to write good SQL and how much code you already have written in SQL Server dialect.
 
Well I found out that their syntax works and mine throws a duplicate key error, so clearly I fail somewhere... 😳
Still minifying the issue but will post back when I figure out the new and exciting way I’ve decided to be dumb du jour
 
8:15 AM
okay... just so i don't waste, the next 90 minutes rubber ducking something super obvious...
-- broke
update sc as foo set
    "name" = concat(acc.name, '_', right(cast(sc.key as text), -2))
from accounts as acc
join sc as sc on sc.account_id = acc.id;
-- woke
update sc as sc
set "name" = concat(acc."name", '_', right(cast(sc.key as text), -2))
from accounts as acc
where acc.id = sc.account_id;
☝️ are those logically equivalent?
at first glance is all, gonna make it tidier as i continue to minify
 
Morning
Yeah. I occasionally use fat loads too: Mc Donalds, Burger King, ...
 
8:41 AM
@PeterVandivier In the first one, the updated sc instance (aliased foo) doesn't appear to be connected with the results of the join in any way
Which to me says it's cross joined to the results, meaning in turn the update is non-deterministic
 
sunuvabeach... 🤦‍♂️
i'm so used to using the alias in damn first line
and declaring the alias in the from block
 
@ypercubeᵀᴹ What do you mean by "recognize" there? SQL Server recognises a non-det update, but doesn't disallow it. It adds ANY aggregates to ensure each target row is updated at most once. The same update as a MERGE does disallow non-det updates.
 
8:56 AM
Not sure but I think at some point he switched to talking about recognising whether the joining column (or set of columns) produced by the CTE is unique or not.
 
fwiw - switching to the 'cube syntax that ensures a clean join still throws the error as before, the rabbit hole continues for now
but i'm pulling in to the station, so it continues offline while i switch to the bus
✌️
 
This kind of bus?
In computer architecture, a bus (a contraction of the Latin omnibus) is a communication system that transfers data between components inside a computer, or between computers. This expression covers all related hardware components (wire, optical fiber, etc.) and software, including communication protocols.Early computer buses were parallel electrical wires with multiple hardware connections, but the term is now used for any physical arrangement that provides the same logical function as a parallel electrical bus. Modern computer buses can use both parallel and bit serial connections, and can be...
 
 
1 hour later…
10:03 AM
nope, still just a non-deterministic problem
v. boring, v. dumb, v. big waste of time
> headdesk
cause the one-to-many expansion happens in the cte, you can't join-to-self from the base table back to the cte
 
10:37 AM
@Johnakahot2use Usually the days before you use fast dumps?
 
@TomV-trytopanswers.xyz Now that's strange. Fat loads don't always result in fast dumps.
 
problems with blocking?
or more of an I/O issue?
 
I guess the query plan gets messed up because the statistics are not evenly distributed.
 
Trust me, you don't want a trace when that happens
 
Yeah, a profiler with a filter wold be gross.
 
10:46 AM
you may find that flushing the cache frequently helps throughput
 
 
1 hour later…
11:47 AM
@PeterVandivier As long as you wipe the workspace first
Paul's going to enjoy reading the transcript
 
I saw it in real time
 
12:17 PM
and you didn't chime in with a pun?
are you okay?
blink twice if the kidnappers are in the room with you now
4
 
12:30 PM
Oh no, you've made me do that thing where you consciously think about blinking rather than it being a background task
 
well least try not to think about the fact that you're inhaling right now. and that now you're exhaling. and that now you're inhaling again...
 
I hate you right now
Gets a taxi to Leeds
 
12:53 PM
am i reading this wrong?
> psql returns 0 to the shell if it finished normally, 1 if a fatal error of its own occurs (e.g. out of memory, file not found), 2 if the connection to the server went bad and the session was not interactive, and 3 if an error occurred in a script and the variable ON_ERROR_STOP was set.
➜  py git:(dev) ✗ psql -c 'select 1/1;'
 ?column?
----------
        1
(1 row)

➜  py git:(dev) ✗ echo $?
0
➜  py git:(dev) ✗ psql -c 'select 1/0;' -v ON_ERROR_STOP=1
ERROR:  division by zero
➜  py git:(dev) ✗ echo $?
1
➜  py git:(dev) ✗
i can't seem to coerce exit code 3
 
@PeterVandivier Couldn't think of anything new
 
1:09 PM
postgres@ironforge:~$ psql -f 'onerrorstop.sql'
psql:onerrorstop.sql:2: ERROR:  relation "gurumeditationerror" does not exist
LINE 1: select * from gurumeditationerror;
                  ^
postgres@ironforge:~$ echo $?
3
postgres@ironforge:~$
Only seems to work from a file
It does say '3 if an error occurred in a script' - By that I guess it means it has to be in scripted file
 
This also works:
postgres@ironforge:~$ echo "\set ON_ERROR_STOP on
> select * from smellyfarts;" | psql
ERROR:  relation "smellyfarts" does not exist
LINE 1: select * from smellyfarts;
                  ^
postgres@ironforge:~$ echo $?
3
postgres@ironforge:~$
 
aha! brilliant!
 
Magic internet points please!
 
0
Q: Cannot induce exit code 3 from psql

Peter VandivierThe docs page states (emphasis mine) Exit Status psql returns 0 to the shell if it finished normally, 1 if a fatal error of its own occurs (e.g. out of memory, file not found), 2 if the connection to the server went bad and the session was not interactive, and 3 if an error occurred in a...

they're yours if you can take them
[postgres@vagrant ~]$ echo 'select 1/0;' > foo.sql
[postgres@vagrant ~]$ psql -v ON_ERROR_STOP=1 -f foo.sql
psql:foo.sql:1: ERROR:  division by zero
[postgres@vagrant ~]$ echo $?
3
[postgres@vagrant ~]$
@Philᵀᴹ i even highlighted that text. my primary school reading comprehension teacher would be so disappointed if she knew...
 
1:23 PM
Shitty documentation. Blame that
 
to be fair, i was interpreting that as... "if the error occurred in a script as opposed to a hardware failure"
you mind if i tack a clarifying line into your answer just to make that more explicit?
oh wait no, that isn't it... given your examples
can you get it to work without prepending \set ON_ERROR_STOP on to the first line of a physical file? 🤔
slash i'll put that as a comment as well to even the playing field for non-chatters
 
What would you call the string you are providing after the -c parameter then if it's not a script?
I would read the 'script' in the broader sense of 'a sequence of commands provided either as a file or in the command line'
 
yea, my first "oh i get it now" was still wrong
kind of a theme for me today, really :/
and other days
most days
 
1:39 PM
I mean, I do understand that they may indeed have failed to clarify that it was meant to be a script file, I'm just curious what the other thing would be called
 
2:13 PM
ah... so it is file only when using the -v flag :/
herp a diddly derp
 
It was more intuitive pre greyskull
 
I love a good goto
if (pset.on_error_stop)
goto loop_exit;
 
what happens if on_error_stop is not set?
on error resume next?
 
on error moan_on_slack
 
even without errors sometimes
 
2:20 PM
on error ask_on_stackoverflow
 
2:33 PM
in Tavern on the Meta on Meta Stack Exchange Chat, 12 hours ago, by Shog9
In other news: just signed my paperwork confirming that I'm eligible to work in the US and like money put into specific accounts. So I'm officially no longer unemployed!
Well that's good
 
I never realized he wasn't American
 
everyone has to say that they are elligible, whether they are american or not (and whether they are elligible are not)
 
@PaulWhite9 you have to sign to confirm you like money?
 
@TomV-trytopanswers.xyz He is. It's part of the standard hiring routine in the US as far as I can gather.
 
2:36 PM
@Lamak Well presumably that you want it put in a specific account, rather than spread around at random?
 
@TomV-trytopanswers.xyz so weird
 
Ah so he just had to tell his future employer "im ok to work in the states", that's what got me confused, not the accounts part
 
Americans eh
 
"confirming that I'm eligible to work in the US " is just something the future employer asks so they know you don't need a visa or whatever
 
you also have to sign papers telling the company how much to withhold in tax on the understanding that you're both wrong and that you'll pay a couple hundred bucks sometime in april every year to figure out what you should have written the first time
 
2:38 PM
@PeterVandivier yeah, I'm glad that the taxes thing here is a lot more straight forward
 
@PeterVandivier that's similar here. Only the company sets a rate for everybody, and you have to ask for another rate in writing if you want something else (within limits)
At the end of the year you file taxes and either pay or receive the difference from what you already paid vs what you needed to pay exactly
 
@Philᵀᴹ i wish i could upvote an edit
 
Screencap his rep and edit it in paint
That's what I do
 
Here we have a tables that defines withhold rates according your salary
 
@McNets Yeah but I don't assume they take into account your marital status, number of kids, random deductibles etc
 
2:46 PM
Yes, you must tell the company if you're married, kids and some healthy status.
 
Maybe they do take into account what tax bracket you are in in Belgium as well,I never asked the question
Tax laws are too complex in Belgium, the only thing I understand about them is I have to pay too much
 
There's a lot to be said for simple tax rules
 
At least HRMC mostly sort it all out
 
HRMC?
 
HMRC
 
2:49 PM
☝️also the sound i make when i get letters from them
 
HMRC
 
Her Majesty Revenue and Customs?
 
Her Majesty's Revenue and Customs
 
@PaulWhite9 Yeah, it's like they started with something and then over time kept adding exceptions and deductibles and extra charges depending on whatever politician was responsible at some point wanted to do. Now nobody wants to change things significantly because there's always somebody afraid they will have to pay more.
 
I bet it all sounded like a great idea at the time
 
2:51 PM
The only reasonable solution is make a big spreadsheet, come up with averages and start over and simplify things. Of course, the average thing can really hurt if you were an outlier before the change
but I'm sure we could come up with a set of simple rules which would provide the same income for the government, and close enough to the same amount for the earner
 
Once it was simplified, the temptation to add tweaks would be hard to resist, I'm sure
 
We cannot simply the tax law in the US, lest it put the companies that make tax preparation software out of business
I mean, the government already knows whether you're married, your employer has provided information on how much you've been paid, financial sector provides info about your earnings/losses. The only thing that you'd need to supply is stuff that you think makes your taxes less - charitable donations and such
Yay capitalism. The best ism there is
 
The maddest thing about Americaland taxes is having to do a tax return & pay taxes even if you're a US citizen but aren't a US resident. It's insane
 
3:07 PM
True freedom
 
Freedom isn't free
Nor is my chiken
 
And even that is taxed
 
@PaulWhite9 Soon to be chlorinated if Boris gets his way.
 
You should see the tax it imposes on the arteries
 
@ConcernedOfTunbridgeWells Chlorine is one of the eleven herbs & spices
 
3:14 PM
@PaulWhite9 I wondered what it was.
 
3:42 PM
Can anyone think of any reason why i would have two constraints on the same column? one referencing column values of a table and the other hard coded values?
ALTER TABLE [dbo].[tblScheduleGroupConfigurationSchedules]  WITH CHECK ADD  CONSTRAINT [FK_tblScheduleGroupConfigurationSchedules_tblScheduleFrequencies] FOREIGN KEY([ScheduleFrequency])
REFERENCES [dbo].[tblScheduleFrequencies] ([ScheduleFrequency])
GO

ALTER TABLE [dbo].[tblScheduleGroupConfigurationSchedules] CHECK CONSTRAINT [FK_tblScheduleGroupConfigurationSchedules_tblScheduleFrequencies]
GO

ALTER TABLE [dbo].[tblScheduleGroupConfigurationSchedules]  WITH CHECK ADD  CONSTRAINT [CK_tblScheduleGroupConfigurationSchedulesScheduleFrequency] CHECK  (([ScheduleFrequency]=(2) OR [ScheduleFr
 
The referenced table starts off empty & you have to prevent people putting crap in the referring table?
 
but then you just get information in the referenced table first though no?
 
@WhatsThePoint perhaps the CHECK was the initial design and then they added the FK and the reference table.
And forgot to remove the CHECK constraint when the change went well.
 
Or perhaps they put the CHECK on the 'wrong' end of the relationship.
 
@Philᵀᴹ it's the same in Greece. I'm 6 years abroad and haven't yet managed to move to "Resident in Foreign country" status.
@PaulWhite9 and you were right of course about "cannot recognize" thing. I should have said "allow"
 
3:59 PM
gotcha
 
I think we had discussed this issue years ago, either with Aaron or with you.
 
It comes up now and again yeah
 
Which version was this implemented? I mean is there a n old version (2005, older?) that allows an UPDATE to update a row multiple times?
 
I hope not. That would be a horrible bug.
I'm not saying it never did btw.
I just don't know.
Triggers would have been fun.
I'm going to go out on a limb and say it was never allowed.
 
Postgres has a similar problem/solution for updatable CTEs.
Since the feature is commonly used to UPDATE / INSERT into / DELETE from multiple table in the same statement, the problem appears when 2 or more CTEs try to update the same (rows in the same) table.
It works by giving each CTE its own "copy" of the initial table to update but of course only one of them succeeds to write to the real table.
 
4:09 PM
hm
 
Yeah, it can lead to unpredictable results if not written carefully. dba.stackexchange.com/questions/151199/…
 
did you mean to link to a 2nd post?
 
> I am writing a large, multi-step CTE for performance reasons.
 
@PeterVandivier yeah. that's .. questionable
 
4:23 PM
tempted to downvote b/c the hyperlink on "for performance reasons" links to an actual post and not this image
 
if he had said to avoid locking issues, I might agree
 
4:45 PM
i feel like "yes", right? b/c you don't add the forwarder DB's to the AG until the very last bit, feel like you could exclude some source DBs and it would all run without error 🤔
not sure what happens as it runs though 😜
/cc @Taryn i guess ¯\_(ツ)_/¯
unless you've already "just done it", i guess that tweet is from a few hours ago
kind of wondering if that blocks log truncation for the omitted DBs
 
 
1 hour later…
5:55 PM
Coronavirus is here
 
6:11 PM
In Barcelona you mean?
Hopefully not in your family
 
@TomV-trytopanswers.xyz yes in BCN, an Italian resident
I don't think it's so dangerous if you're healthy
Flu has killed more than 100 ppl this winter, usually old ppl with another healthy issues
 
you guys ever see ssms crash when you try and test dbmail?
get some extra food though - there's some videos of empty shelves in Italy
^(those two sentences are not related)
 
> I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion, SSMS crashing testing dbmail...
2
@James 😂 maybe you'll need to put your sql server in quarantine
 
6:29 PM
I'd jump straight to euthanization
hmm that came out darker than I wanted it to
 
7:14 PM
Corona in Switzerland too.
and Tequilla
 
Why would you drink such terrible alcohol when Germany and France are right there?
 
Jägermeister for everyone
 
No we prefer Appenzeller.
No but seriously. First confirmed case in the southern-most canton of Switzerland, Tesssin / Ticino.
@James Well, there are slight differences in the quality of tequila. Just like with single malts.
 
7:32 PM
Switzerland is famous for its majestic agave groves
little known fact, the sport of slalom was invented in switzerland by farmers inspecting their crops at high speed
 
I thought it was that shooting-skiing thing, and now I want to play it, but with alcohol
 
the shooting-skiing thing doesn't have a name in traditional Swiss. it's too ubiquitous. the literal translation is "commuting"
"biathlon" is the name assigned to it by Flavius Aetius on his conquest of Alps but it is considered offensive to use this word in polite company
 
Does it mean that sport is for rude people only?
 
One doesn't normally call those toting guns "rude" to their face
 
Fair enough
 
7:42 PM
guns *and tequila
 
8:03 PM
@McNets I didn't survive the 90s rave scene to get killed by a virus named after light beer
 
8:24 PM
@PeterVandivier sure?
@TomV-trytopanswers.xyz ah, you said "light beer"
 
8:53 PM
Am going raving in a few weeks. Yay. bangface.com
Lots of DnB and Techno
 

« first day (3339 days earlier)      last day (1515 days later) »