« first day (4278 days earlier)      last day (888 days later) » 

00:20
Ten minutes to go
 
5 hours later…
05:38
Morning
heap, queue/deque, foreign analysis, rant.
05:53
@Zikato Morning, just read the text. I'm moving here from Root Access. I can't believe I had to go straight there to get to here.
I'm sorry for saying contact db is cost to share. I'll move out into server fault if need be, until I learn to become a good host server.
...
I want access to the media server where I'll be at.
06:08
Sorry, it's probably too early in the morning for me. I have no idea what you're saying
 
1 hour later…
07:09
@PaulWhite I regret remembering it if that helps at all
08:05
morning
08:39
@ErikDarling little bit yeah
 
1 hour later…
09:46
I have a moral dilemma. Did everyone hear about Hugo Kornelis' health situation?
the twit was reposted here
When reading the news, I read about an experimental trial (for the very same diagnosis Hugo shared in his post) which saved the patients life
I'm not sure whether to share it now that he's undergoing chemo. Because for the patient in the article, the chemo didn't work out, and they were considered terminal.
Tough call. On the one hand, it's one way to show you're concerned enough to care to mention it. OTOH, you're sort of assuming his medical team wouldn't be aware of such things (and perhaps more besides).
People understandably tend to overthink such things. I don't think it matters much which way you go on this. Either action would be reasonable.
10:01
I think it's probably best to wait until after the chemo. If chemo works out, then no need to mention it. If it doesn't it's probably better to share even if the medical team know
Sure
@Zikato By the way, would you be prepared to be a room owner here?
Not there's ever much to do, but I do like to maintain the room owner list of active users with vaguely sensible ideas of acceptable chat behaviour, just in case.
2
I'm honoured, but could I put that offer on hold?
I'm starting a new job in 2 weeks, and I'm assuming I'll be a lot less active.
Sure, no worries. It's entirely optional.
notes Zikato's lack of commitment to the community
Fair assessment.
If I commit then I'll have to push harder, but I'm afraid of conflicts
10:18
So, it's not just that you're czechen? 🐔
that's a bit of a stretch
yeah
it's early for me, first coffee in progress
understandable
Power corrupts...
Usually when the voltage is too high, that is
11:47
Going to start using implicit transactions by default
A chairde - Morning all!
12:20
2
A: Is there a way to insert multiple rows into a table with default values for all columns?

JasenThere's no rule that select statements must return one or more columns. If the select returns zero columns in several rows you will get rows inserted with all default values. INSERT INTO table_name SELECT FROM generate_series(1,10);

A neat answer appears after 7 years
yep. good one
@ypercubeᵀᴹ it wasn't entirely at random of course, they were answering a related question by degrees.
In Postgres you can apparently have a CREATE TABLE with no columns also.
why you would want that is a different question
I like the Postgres features for basic relational concepts like that.
Tables DUM and DEE etc.
also see the discussion after this comment
Jan 3, 2017 at 8:30, by TypoCubeᵀᴹ
@MartinSmith for one, it is not SQL standard. SQL tables should have 1+ columns.
12:30
> As an aside, Chris Date has defined two tables, Dee and Dum, in his Tutorial D language. His Dum table is empty and contains no rows at all; Dee has a single row, But this row has no values in its column (This makes keys a bit difficult to define). He uses them to model TRUE and FALSE, respectively. It might be worth remarking that tutorial D has no concept of NULL.
Little practical use, but it is nice to have a sound theoretical foundation for things
I had an answer somewhere of how to constraint a table to max 1 rows, using a PK with 0 columns.
CONSTRAINT zero_or_one_rows_pk PRIMARY KEY ()
Yes, I remember that
that's an interesting problem
I'd probably use a Czech constraint with a specific value on a PK column
3
Like CREATE TABLE dbo.OneRow (v integer NOT NULL UNIQUE CHECK (v = 1));
it's weird that people find a column-less table weird but have no problem with tables without any unique constraint or result sets with duplicate rows.
12:45
I guess the only thing you can store in a table with no columns is the number of rows, and for that you might as well just store a single row single column of NumRows
@ypercubeᵀᴹ right
hey i think you're all smart and great
4
also SQL Server execution plans feature streams with no columns all the time
nice, didn't know that
common for semi joins
12:56
If we are going down the road of "what can the execution plan have that you can't do in SQL"...
this question was sort of cute. it. never would have occurred to be to stack references to select a column.
CREATE VIEW dbo.OneRow AS SELECT One = COUNT_BIG(*);
GO
CREATE VIEW dbo.NoRow AS SELECT Zero = COUNT_BIG(*) WHERE 0 = 1 GROUP BY ();
@Zikato
@ErikDarling I enjoy people's optimism commenting on, and answering, a migrated question where the user doesn't have an account here
Of course JD probably just commented out of habit
@Charlieface yes, well, the point is the SQL Server relational engine does these things. We can argue all day about how 'relational' SQL is.
@PaulWhite I hope you aren't indexing that view sqlperformance.com/2015/04/sql-indexes/…
13:08
> Msg 8665, Level 16, State 0, Line 8
Cannot create the clustered index "cuq" on view "dbo.NoRow" because no row can satisfy the view definition. Consider eliminating contradictions from the view definition.
(I did index my first versions of those views, but ultimately didn't see the point)
wow, SQL Server is smart
@Charlieface Another bug @SeanGallardy-MostlyRetired is too lazy to fix
(caveat: I haven't checked if that bug still exists recently)
It was quite amusing being able to vote and flag when the site was read-only earlier using the old iOS app
Looks like QP stuff - no thanks
@PaulWhite That's a cool error, so someone actually special-cased such a view to prevent it being indexed? One wonders whether they have better things to do with their time
13:17
@PaulWhite it was an easy answer, not sure there's any optimism involved
@ErikDarling Ok, fair enough about the answer, but the comment is optimistic
Optimistic you'll get accepted, perhaps
But you're here for the great good of mankind, not points so
13:31
CREATE OR ALTER VIEW dbo.NoRow WITH SCHEMABINDING AS
SELECT Zero = COUNT_BIG(*)
WHERE LEN(CONVERT(varchar(max), '')) < 0
GROUP BY ();
GO
CREATE UNIQUE CLUSTERED INDEX cuq ON dbo.NoRow (Zero);
Commands completed successfully.
23 hours ago, by Josh Darnell
Amateur hour
\o/
yesterday, by Sean Gallardy - Mostly Retired
My whole point was, while using 90 proof alcohol to run your car might work for a little bit, don't complain when it kills your engine and expect it not to when it's not supported
@PaulWhite i am OPtimistic that my answer will be helpful
Pity upvote issued
We have a Windows Service that uses the ACE driver, and the number of times this service crashes due to ACECORE.dll throwing an access violation makes me really appreciate Microsoft's position on not supporting that thing being loaded into SQL Server permanently.
> user212215 what did you see?!?!
@ErikDarling I'm actually impressed you worked out what that question's code was trying to do
It still gives me a headache
13:38
because i'm inexperienced?
sounds like that might be an advantage in some scenarios
experienced with develOPer code perhaps
idk
maybe i have a lot of experience with bad questions
and invoices
putting the oi into invoice
inv-oi-oi-oi-ce
oi: the invoice
14:36
I just checked. The user is unregistered on GIS, so there's no chance of them arriving here
I've seen people prefer to build queries exclusively with outer joins before
APPLY is more usual in modern times
well good
solid mod work there
this is uh
-3
Q: How to improve Database Slow perfomance in SQL server

KeembestPlease I need help optimizing my database performance. I have done some profiling to see seek queries using BlitzCache script created by Brent Ozar. After executing the script, some number of queries was listed which I generated an execution plan which can be found on the following link. https://...

Way to APPLY yourself
@ErikDarling Looks like a Microsoft query
A hopelessly lost user
hot4user
14:51
question tagged c# of course
maybe sean can tune it
Sean couldn't tune a radio
15:08
@PaulWhite never let the radio tune shawn.
@PaulWhite I'll tune you :D
Gotta tune you, it's a fine line
Hmmm, poor formatting, poor use of subqueries rather than APPLY, use of top 1 1 in an EXISTS, use of system functions instead of joining system tables. Definitely an MS internal query.
15:49
with resumable constraints
like uniqueness ones for instance
do they do anything to keep duplicate data out while they're in a waiting state
or can you add a duplicate row at the last second and make the whole thing error out
That's an interesting question.
16:06
@ErikDarling I'm not sure, I didn't work with it but if I have some time today I'll try to take a look.
> When you create or rebuild a UNIQUE index online, the index builder and a concurrent user transaction may try to insert the same key, therefore violating uniqueness. If a row entered by a user is inserted into the new index (target) before the original row from the source table is moved to the new index, the online index operation will fail.
The almighty Docs Learn has spoken.
@SeanGallardy-MostlyRetired 🤣
that's uh
wack
real wack
16:29
use a twigger
but realistically, what data are you trying to create a unique index or constraint on that might not be unique
seems sub-optimal somehow
if the goal is to keep bad data out and bad data gets in that seems annoying
right, but think about it
if the table is small, do the unique-add offline
if it's not small, it's existed for a very long time without dupes
Don't send in bad data. It's that simple
I look at resumable like an extra layer on top of online, for DBAs with limited maintenance windows
If it didn't work online, it won't work any better resumable
Probably worse, because newer feature = more bugs
16:37
You can't use that logic around here
Can't use any logic round here
no i get it
i just always want something helpful that doesn't exist
Perhaps we'll get a WITH_ROLLBACK_USER_DUPLICATES option in future
Might be tricky to efficiently detect that though
Unless there's an existing helpful index to find any potential dupe
Seems unreasonable to ask SQL Server to build a unique index, and reject any duplicates before it has seen the whole set.
Time travel might be needed?
You should tell our customers that
They wouldn't listen anyway
You could ask SQL Server to reject any new dupes for rows it already has in the part-built index
i can just imagine someone spending several nights creating one of these just to have it fail at the end
sounds like a Sev-A
IGNORE_DUP_KEY_DURING_BUILD
@ErikDarling Hence my suggestion for a temporary INSTEAD OF trigger
But again, you'd need an existing non-unique index to make that efficient
@ErikDarling Right, but how do you know if a value is a duplicate before you have an index?
I'm not saying it's impossible, just trying to figure out how it could work
Without faster-than-light travel
I could have inserted and committed a row days ago, that SQL Server happens to build into the unique index right at the last minute
16:44
perhaps a temporary hash table or use of the histogram
might as well use the index/mapping table you're already building
but again, you could only detect collisions in data you've seen so far
i think the basic check is if a new value being inserted is lower than the max value already added
How do you know that value existed though? Or that the sort phase is complete?
you don't
perhaps resumable indexes need a delta store
🤔
What they need is magic
16:49
magic is very popular
I think it could work so long as there's an existing non-unique index with the same keys
So you could build the non-unique index, then make it unique after
And you'd have an easy way to check for concurrent key violations
But who has time for that
Sounds like a DBA problem anyway
Or
OR
Host the database on GitHub and resolve the merge conflicts manually
Genius
17:11
-2
Q: SQL help requested

Chris FernandezI have a query I need to modify to bring in another translation from a code to a text field in a translation table (Code_Desc) It currently works with a single translation, I get errors when trying to add the second. Code Below. SELECT DISTINCT T1.* , C1.TX_DESC_LRG AS CASETYPE ,C2.TX_DESC_LRG ...

@Zikato One for you ^. Problems despite generous application of DISTINCT
Help has been requested
shot in the dark - has anyone applied 2019 CU17 on an instance where you've got hekaton in an AG?
having an issue with our patching scripts and i'm afraid i'm gonna need to head down the rabbit hole
@PaulWhite lol at "generous application of DISTINCT"
17:27
@PeterVandivier Almost, we're on CU16. What awaits us?
@PaulWhite oh I can't write SQL. I'll fake it till I make it
A distinct advantage
actually i don't think it's an issue with the CU just yet. the secondary replica is going into not-sync/recovery pending in (i think) the script line just before we apply the patch
so i'm gonna repair the replica and see if i can repro the break real quick
for science dot gif
Does Sybase allows this nonsense? I thought only Mysql had that privilege
HAVING EP.ID_EPSD = MAX(EP.ID_EPSD)
18:02
well that was a real chat killer
yesterday, by Paul White
No one cares about ADS. Give it up.
insert sybase here
Stuart: Oh, Sheldon, I'm afraid you couldn't be more wrong.
Sheldon: More wrong? Wrong is an absolute state and not subject to gradation.
Stuart: Of course it is. It's a little wrong to say a tomato is a vegetable, it's very wrong to say it's a suspension bridge.
"generous application of DISTINCT" reminded me of that haha.
It has more DISTINCTs than query expressions. It was probably on sale.
18:58
blerg, working theory is something something resource governor something something but I can't repro it and i'm not sure I'm willing to spend time rolling back windows patching in further attempts :\
19:52
Sounds like a good question
Especially on a site with Top Men At Microsoft
20:23
We should all move to that site
 
1 hour later…
21:40
@ErikDarling "The Swiss invented time" - No, they didn't. As everyone who knows their classics will tell you - it was Stephen Hawking - and that's straight from the horse's mouth - Penny from the Big Bang Theory!
@Vérace i refuse to watch that show. obvious propaganda.
From whom? Aliens?
if the swiss didn't invent time, they certainly perfected it
QAnon?
nerds
huge nerds
21:42
They may have perfected TIMEPIECES, but not time itself - it's well, err... timeless!
I think I need a glass of wine!
never have just one
they get lonely
I find that if you're not careful, they breed!
How would a SQL Server man deal with this baby?
0
Q: Select telemetry data based on relational data in PostgreSQL/TimescaleDB

kk_pI'm trying to solve a particularly difficult problem. I am storing some telemetry data from some sensors in an SQL table (PostgreSQL) and I want to know how I can I write a query that will group the telemetry data using relational information from two other tables. I have one table which stores t...

wow, that join on overlaps syntax is wild
I've got two answers - not sure if my approach is a good one - I'll write them up as an answer tomorrow - spent much of the day doing them!
i'd have to resort to union all to replicate that i think
at least so it performs well
join on between makes me prickly
21:46
Now that was cool - I'd gotten that far myself - didn't think of LEAST/GREATEST though - was kicking myself - but my solution(s) are kinda cool - make use of another deadly PostgreSQL feature - range types!
Not mad keen on the OP's 13 CTEs!
it is a bit much
An optimisation nightmare I would imagine!
I've one decent answer which has 1 subquery and the correct one which has 2 - it's just that bit clunky though. Might offer a bonus or something and see if the great EB can be tempted to answer!
He'd probably do it in 2 lines!
22:11
i'd be more impressed if he did it on two wines
What do you think I'm doing? :-)
22:53
hard to tell
bottle is in the way
You mean you can only see one? :-)
I'm on fire - I got the correct answer with only 1 subquery and no use of range types! I'm knackered though - I'll post the answer tomorrow - do you have any further thoughts on tackling it?
I don't want to show me my own answer lest it influence yours - just give me a broad idea of how you'd tackle it - using PostgreSQL (as per question) or SQL Server?
23:49
i wasn't even going to try
What the hell
what the hell yourself
Hell yeah
13 CTEs. Unlucky for some
Should be easy with a regex I think

« first day (4278 days earlier)      last day (888 days later) »