« first day (2402 days earlier)      last day (2467 days later) » 
00:00 - 15:0015:00 - 00:00

12:26 AM
@JoeObbish Sorry one more thing, doesn't there need to be a test on @fromUpdateId inside the not exists as well?
 
1:03 AM
The recursive solution might be quite reasonable
 
1:27 AM
yeah you're right
@PaulWhite How would you do it? concatenate the values that you've already found together?
 
I just hate writing recursion that keeps stuff in a string
Yeah that's the usual technique
tbh a dynamic cursor works quite well
 
I never used recursive queries at all
until the cube inspired me one day
 
cursor: 350ms ish on your test data with 5000 rows and no new index
None of this really being in the spirit of his question
Which is mostly that Flow Distinct ought to preserve order
Which I sort of agree with, except that the hash table might spill
 
yeah I thought it would do well, I just didn't want to write it
 
The other thing I struggle with is the awkward SQL syntax for this requirement
There should be something simpler
Perhaps there is in other products
 
1:31 AM
in the standard you mean?
 
Ideally
 
it's a really odd query to write
he talked about pagination by UpdateId
but UpdateId isn't in the results
 
I'm not sure if the standard mandates that order by columns must be in the distinct clause
 
so you return the next 100 ids, but how do you know where the next page starts?
 
@JoeObbish Yes I asked a question about that and it was waved away (see update to the Q)
I would have thought the last id touched should come back as well
 
1:33 AM
he probably just got curious
I doubt this has much practical value
 
But hey there must be more going on and it doesn't really change the fundamental discussion about Flow Distinct much
@JoeObbish You might be right
 
it's the type of question I would ask
your friend just posted an answer
 
@JoeObbish Yes I mentioned it to Rob
Ah he's missed a crucial point
 
I mostly like this one
though it has at least two problems, I think
 
Yes a window could work well
If we had DISTINCT support
 
1:39 AM
Will the COUNT window function respect the predicate and quit early?
I know that ROW_NUMBER() does
 
It might do. It would depend on the implementation.
 
LAG does too, though maybe because I think it's just a bunch of RNs behind the scenes
oh, meant in SQL Server
I think I tried it a few hours ago and it didn't
 
It's not valid syntax in SQL Server. Yet.
 
right
but if you remove the DISTINCT it still scans the entire table
I don't think I'm explaining myself very clearly
that trick with ROW_NUMBER that you do with recursive queries
most window functions don't work like that, right?
 
I know what you mean
Some can, it depends on details
In other cases it doesn't matter so much because the calculation is cumulative
But in any case, it could, logically
Oh the other solution I used for this is a SQLCLR "cursor"
i.e. a stored procedure that reads from a non-context connection in order
@JoeObbish Not with a FAST n hint
IOW a pipelined (non-blocking) plan is possible
 
1:46 AM
well aren't you fancy
 
Top hat and everything
 
hm
it looked good
but still scanned the whole table
let me check if I did something wrong
ah
need a row goal as well
rather, need a TOP
FAST doesn't appear to do it
makes me wonder if any of the ways of emulating a COUNT(DISTINCT col) OVER() would work...
 
@JoeObbish Dynamic cursor IYI: pastebin.com/8xNWaZ03
 
I have no idea what that is :)
couldn't you do the same thing without the cursor?
I suppose you could put it in a TVF
 
@JoeObbish Sure, if you want to run it.
@JoeObbish No idea what what is?
 
1:52 AM
never seen a dynamic cursor
 
WTF
 
what
 
You've never seen a dynamic cursor?
 
no!
 
Far out
That's the default!
But you know how cursors work eh
 
1:53 AM
I always change mine
I don't do exciting things with cursors
I just do what Aaron says
 
Well it's a bit of a waste materializing the cursor and numbering the rows if you don't have to
 
if I was to code that I'd do it without a cursor
wonder how much slower it would be
 
1:58 AM
yes
it's surprisingly fast
oh
it doesn't work
that's why
if I return the results they seem ok
forgot the most important part at the end
 
Yes that's the same basic idea just not as cool as executing a single plan one output row at a time.
 
the dynamic cursor is a little slower on my machine
which is very odd
 
Well I never said it would be faster
 
not a knock on you at all
the implementation must be off
 
Getting every op in the plan to save it's position involves a bit of work
But it's very cool and quite flexible especially when used with an API cursor
When you're not limited to one row at a time
But mostly I like it because the received wisdom is that dynamic cursors are slow
 
2:05 AM
I need to go face my biggest weakness
rolling out dough
 
I was just about to say "cooking"
 
2:16 AM
My guess would have been "photography"
 
@sp_BlitzErik Especially selfies?
 
oh
so dynamic cursors
I have used those
now I understand your confusion
 
my confusion ok
 
someone ask me how it went
 
how did it go, Joe?
 
2:20 AM
your disbelief
 
I think you used the wrong gif
 
I did not
no one gets it?
 
Eh it's just
Lackluster
 
So ... it took a long time?
It broke apart?
You baked a planet?
 
Perhaps he made a continental breakfast?
Oh! Was it paleo?
 
2:35 AM
That must be it
Great gif
 
3:00 AM
I started rolling out the dough
and it broke apart like the continents
it was a disaster
 
 
3 hours later…
6:09 AM
Morning
 
morning
 
Kopisanangan dongkosuabon (Central Dusun; Malaysia)
 
Morning
 
gbn
7:00 AM
Hello
 
Morning
 
 
2 hours later…
8:56 AM
Primary key: a unique constraint with delusions of grandeur.
4
 
At least it will perform better because it doesn't allow nulls ;)
3
 
Especially if you make it clustered
2
 
I was thinking of dbs, as explained to a psychologist
Corrupted backups: a case of dementia
Queries giving inconsistent results: a database with schizophrenia
Maintaining triggers: one step before the asylum
 
I'm out of stars
3
 
Joe would probably make it custard (he likes cooking)
 
9:06 AM
@PaulWhite That would be for the database cook book!
Custard Index
 
snort
 
@gbn, are you around?
I'll be near, for an hour or two.
 
I'll stop at Zurich at noon.
 
gbn
plane? train? or automobile?
 
9:10 AM
plane. London to Athens
 
gbn
Are you on the plane now?
Landing at noon puts you over Paris right now
 
@ypercubeᵀᴹ hollidays?
 
@gbn No, I guess noon wasn't very accurate. Take off at 12, so around 15 at Zurich
(12 in UK, 15 in Swiss time ;)
@McNets yes
 
gbn
how long do you have in zurich?
 
1 hour and a half I think
 
9:17 AM
@ypercubeᵀᴹ enjoy it!
 
gbn
Heathrow is in the news. Total cock up it seems by British Airways
And Gatwick
 
@gbn Wasn't that a month or two ago?
 
gbn
Another one telegraph.co.uk/business/2017/08/02/… and other newspapers
 
@gbn ah reading now.
It's good that I don't fly with BA today! It's pretty quite at terminal 2.
 
gbn
This is me "It's good that I don't fly with BA". One ariline I do not like
 
9:27 AM
I hope there is not much delay in Zurich, due to the security measures.
 
gbn
Not normally. It's quite efficient, even for non-Schengen arrivals. And the airport is quite compact anyway. I transferred va Paris CDG a month or 2 ago: I walked for ever, then waited for some time at passport control
 
@gbn I read that the increased measures has caused issues. But mostly in touristic areas, Spain, Portugal, etc.
I had another pass through Zurich, 2 years ago. It was efficient, yes. I had less than an hour I think between flights.
 
gbn
@ypercubeᵀᴹ I saw that too. And gave thanks I don't live in the UK. We've been there twice in 4 years and that's too much
 
9:58 AM
Old cross-post:
1
Q: Stored Procedure count and list the occurrence using like from another table

vinravActually this is my first procedure apart from basic "Hello world" procedure. I have two tables like this: cars users ------------------------- --------------------------- | car | description | | name | car_owned | ------------------------- -...

1
Q: MySQL count and list the occurrence using like from another table

vinravI have two tables like this: cars users ------------------------- --------------------------- | car | description | | name | car_owned | ------------------------- --------------------------- | BMW | Good Choice | | abcd | BMW, nano ...

What can/should we do?
 
@AndriyM No upvoted answers, one is a copy of the SO one, closed and deleted.
 
@PaulWhite Thanks.
I can go to lunch now
 
Yes you may.
 
10:56 AM
:)
 
 
1 hour later…
12:03 PM
I think this edit should be rolled back:
1
A: Delete almost 10 million rows each day

Ali Bagheri ShakibI think you should delete with this query : WHILE 1 = 1 BEGIN DELETE TOP (10000) FROM tableName WHERE condition; IF @@rowcount < 10000 BREAK; END You wrote : SET cnt = ROW_COUNT(); . Do you mean @@rowcount? Thanks for answering, Ali Bagheri Shakib I guess both while block looks ...

AKS added a comment to the answer.
 
rolled back
 
@dezso Cheers
even though the person answering approved the edit
 
An unintended consequence of a new functionality.
 
@hot2use Thanks. Please raise a custom mod flag next time as well.
 
why
why was this the first question i clicked on today
0
Q: SQL Server - how can a select be so long

JidiI was wondering if it is normal to have a simple query like below taking 6-7 secondes on a table with 'only' 300 000 rows. I'm working on SQL server 2014 and a sgbd taking so much time to return "not that much" data is quite surprising to me. SELECT [Id] ,[b] ,[c] ,[d] ,[e] ,[f] ,[g]...

@ypercubeᵀᴹ would a constraint on a binary column have delusions of gender?
2
 
12:16 PM
@sp_BlitzErik No doubt the nvarchar(max) column contains a nested database
 
"what's the nvarchar(max) for?"
"guids stored in xml"
 
gbn
Or more boringly he's running SSMS on an old Nokia
 
No worries on Tom Tom's Nokia
@sp_BlitzErik Actually it's a rather clever new form of xml he's calling Jason.
 
i should stop calling mine fred, then.
 
What kind of monster names their columns a,b,c,d...
 
12:19 PM
the anonymonster
 
Heh
 
@PaulWhite will do. Was on the verge of doing that.
 
gbn
@sp_BlitzErik Any fule knows it should be unsigned tinyint
ISO/IEC 5218 Information technology — Codes for the representation of human sexes is an international standard that defines a representation of human sexes through a language-neutral single-digit code. It can be used in information systems such as database applications. The four codes specified in ISO/IEC 5218 are: 0 = not known, 1 = male, 2 = female, 9 = not applicable. The standard specifies that its use may be referred to by the designator "SEX". The standard explicitly states that no significance is to be placed on the encoding of male as 1 and female as 2; the encoding merely reflects existing...
 
@hot2use Cheers. Others can take care of the immediate issue but it's good to make the mods aware of things like this, and flags don't get missed like chat messages can.
@gbn is chanelling Joe Celko today it seems
 
gbn
@PaulWhite "Cool Joke"
 
12:21 PM
Gender (BIGINT) NULL
D:
 
gbn
Some of us need bigint for our gender
2
 
Deary me
 
depends on the unit of measure, probably ;)
"Hi Erik,

Could not able to post throwing some JavaScript error which blocking failing to post."
 
@sp_BlitzErik Ångströms?
 
@PaulWhite Smoots!
 
gbn
12:23 PM
 
The smoot is a nonstandard, humorous unit of length created as part of an MIT fraternity prank. It is named after Oliver R. Smoot, a fraternity pledge to Lambda Chi Alpha, who in October 1958 lay down repeatedly on the Harvard Bridge (between Boston and Cambridge, Massachusetts) so that his fraternity brothers could use his height to measure the length of the bridge. == Unit description == One smoot is equal to Oliver Smoot's height at the time of the prank, 5 feet 7 inches (1.70 m). The bridge's length was measured to be 364.4 smoots (2,035 ft; 620.1 m) plus or minus one ear, with the "plus...
 
So glad context arrived on that one
 
@gbn how many bobcats per second is that?
 
gbn
er...
 
> Vulture Central Weights and Measures Soviet
Curious
Is the word "Soviet" used jokingly or seriously here?
 
12:37 PM
if you have to ask, it's probably a joke
 
@AndriyM Where?
 
sheep velocity article
 
Oh the register one.
 
@sp_BlitzErik My immediate thought was it was a joke. On the other hand, I'm not up to speed with changes in vocabulary. I'd think "council" would work fine there as it has done many times before. But maybe someone liked the word ("Soviet") so much they started a trend and it caught up or something.
 
gbn
English is a borrowing language. Native English speakers (especially Brits) abroad like me will mix languages in one sentence.
So the word "soviet" is more amusing to us than "council", especially because of the historic meaning
I would never say "I'm off to Zurich train station". It would always be "I'm off to the Hauptbahnof"
 
12:49 PM
same
 
So, a jocular translation of "council", perhaps.
 
gbn
Genau
In itself an example, it's more natural to say "Genau" instead of "exactly"
 
@gbn "Genau" and "ganz genau" perhaps?
 
@sp_BlitzErik There are folks who wouldn't view that as binary.
 
gbn
1:01 PM
@hot2use Not heard "ganz genau" in the wild. But of course the Swiss have "exactly" and "completely exact". Nothing is inexact
2
 
@PaulWhite When I was at university we had a lecturer called Tad Takaoka who used to write C code with variable names like that. He was a mathematician by background and did algorithms research - he claimed that he found it easier to read. We used to refer to his code as TadC.
 
@hot2use janz jenau around here
 
1:16 PM
afternoon
probably laughable but if you have any idea
0
Q: ODBC trace that has been activated but how can I deactivate it?

Andy KMy colleague has activated an odbc trace to troubleshoot the issue we currently have. But alas he has created another issue e.g the tracing is activated each time we are running the msaccess program even though we have deactivated the log in odbc. We are using an msaccessprogram that works as a...

 
1:30 PM
Someone just phoned the Helpdesk to complain their desk phone wasn't working at all. They phoned from their desk phone. /facepalm
 
gbn
@Philᵀᴹ Have you been promoted from DBA?
 
@gbn They sit opposite me. Poor chaps :(
 
I would expect sitting opposite you would be a lamentable location, regardless of job role
 
@billinkc a good {part-of-day} to you, too
 
@sp_BlitzErik good one!
 
1:38 PM
Miss you all
 
Your aim never was very good
 
for those interested in minimal logging: blogs.msdn.microsoft.com/sql_server_team/…
TF 692 is the one that I knew about
 
@billinkc You're the one who walked out on us
 
The Heap™ is quite like a tower defense game - @billinkfc appears, throws something at someone, then the others start throwing things at him
4
 
@PaulWhite - that was an excellent answer you wrote on the fallibility of the hash match row distinct. Never in a million years would I have thought about a spill.
 
1:46 PM
@dezso sounds about right
but he deserves for going MIA
 
2:00 PM
Bill's in KFC in KC?
 
2:47 PM
@MaxVernon thanks
 
What did you think of the edit?
 
Congratulations to @aaronbertrand
Got it
 
@JoeObbish Was fine thank you
 
Glad to hear that. I will aim to edit more often.
 
> Any time you see a post that needs improvement and are inclined to suggest an edit, you are welcome to do so.
 
2:57 PM
yeah, but, you know how it is
Did anyone happen to read that MS blog post about minimal logging? My interpretation is that they're saying that TF 610 has no effect in SQL Server 2016.
 
@JoeObbish I know. It's an ongoing battle.
@JoeObbish They pretty much state that explicitly, yes.
 
00:00 - 15:0015:00 - 00:00

« first day (2402 days earlier)      last day (2467 days later) »