« first day (1949 days earlier)      last day (2919 days later) » 

12:05 AM
@wBob That's an un-upvote, not a downvote.
 
@PaulWhite Is this re the "Queries without Good Enough Plan Found". I definitely saw a red -10 earlier on today, at least I thought I did, but really I know I shouldn't worry about these things, and you can't please everyone : )
 
@wBob Yes. -10 is always a retracted up vote (after an edit). If you look at the detail of your rep history, it will be labelled "unupvote".
 
@PaulWhite oh ok, thanks! TIL ...
 
Hot post from Mikael on that hierarchyId question, has inspired me to "trim the fat" on my working query.
 
12:14 AM
5
A: My reputation was reduced by 10, but there was no downvote on the post

MysticialAn "unupvote" isn't the same as a "downvote". So don't confuse them. A "downvote", is a vote that nets you -2. An "unupvote", is the removal of an upvote. In your case, you received an upvote for which you gained +10. Later on, the user removed that vote - thus you lose the +10 that you origi...

 
@PaulWhite Got it, thanks.
Drive by un-upvotes, boo! lol
@PaulWhite you know you do so much for the site, I want to ask, is there a vision, or did you decide that? You guys are really crafting a repository here I think.
 
The vision is that he expose the evil ways of esquel server so that we may find inner harmony with our joyous MysQL
 
@billinkc Yet to convert, should I? ; )
 
But of course
 
@billinkc lol, I am, here in reality, learning R.
 
12:33 AM
5 -> rIsWhack
 
@wBob Not sure I understand the question.
 
@PaulWhite You and a few of the others (you know who you are) put so much into the site, that I wondered if there as a time when you all decided that, and there was a vision, long-term goal or something, or it's just you're all ardent supporters of the community and no more to it than that. I think that's my question really.
@PaulWhite Just blabbering on really, it's late here : )
 
@wBob World domination and infinite riches.
@wBob Seriously: the "no more to it than that" part.
 
@PaulWhite if by infinite riches you mean unicorn points, you're well on your way!
What is the emoji for a unicorn?
 
Ooo I don't know.
 
12:43 AM
Hmm, it's nearly 2am, whether to spend all night rendering a unicorn in the form of ASCII art created by a SQL statement ... or go to bed. Decisions decisions...
 
1:03 AM
It's not as noble as I'd hoped ...
set nocount on
go

select
'                  ,))))))),,,
				,(((((((((((((((,
				)\`\)))))))))))))))
		 ---===///`_       ``((((((((
			   \\\ b\   \    ``(((((((
				))\
				   \    |
					\   |
					 \,/
					  "'
urgh, looks better on my screen, if you can imagine anything looking better than that ^^
#unicornfail
2
And now to desecrate Pegasus ...
 
Ha ha ha. Good effort.
 
The majesty lol ... night!
 
 
5 hours later…
5:50 AM
@billinkc Could be worse. Could be APL.
 
 
4 hours later…
9:47 AM
I must be the only person not at SQL Bits...
 
Nope, Senior DBA went, Junior DBA here holding down the fort :(
 
@MarkSinkinson Didn't go either
 
10:10 AM
@MarkSinkinson I'm going tomorrow.
 
@LemusThelroy not really, looks like a decent question.
 
@Marian I passed the first test!
 
though now we'll wait for of the PG wise to help with the answer :)
 
Answered :)
 
@LemusThelroy I',m not sure if my comment is the answer your issue.
Normally, Postgres would show an error when there is a conflict.
 
10:17 AM
after giving the parameter a different name it is only returning one matching value
which is exactly what I wanted
 
Yeah. your where was parsed as where LOWER(tablename.email) = LOWER(tablename.email)
 
it's lucky my application isn't live. because that would led have to some ugly scenes after people were logging in
 
I wonder why the conflict didn't raise an error
 
Are you thinking it should have said it was ambiguous?
 
@ypercubeᵀᴹ that sucks big time
 
10:36 AM
@LemusThelroy what does this return?:
SHOW plpgsql.variable_conflict;
 
where would I enter that?
 
if you connect to Postgres with psql
as the same user that created/run the function
 
10:50 AM
lol psql: FATAL: role "lemusthelroy" does not exist
will have to get back to you on that one
I am not the best at setting up my environments on linux
 
 
2 hours later…
12:48 PM
@PaulWhite - in my answer on the palindrome question where I show the multi-statement TVF, how can I see that the plan is "bad" - i.e. it executes the function multiple times per row?
in my sample, the plan shows the TVF being "actually" executed 2 times, which equates to once per row in the input table.
morning, @TimStone
how's things in diamond-land?!
Chemical Brothers - Born in the Echos cranked to 11 at 7am is where it's at!
 
besides MSDN, does anyone have any suggested reading links for both Over and Partition from a T-sql perspective?
 
@peacedog you mean window functions I guess? OVER (PARTITION BY ...)
 
yes
wasn't sure if they were t-sql specific
 
@peacedog No, they're standard SQL.
 
excellent
 
12:56 PM
@MaxVernon I don't think it is about a bad plan but about the implicit context switching for each call to the function. That takes time and does not happen for inline TVF's.
 
@ypercubeᵀᴹ. Hey, I wanted to see if we could pick up where we left off yesterday. We were discussing transactions within functions using postgres. Something like:

I was thinking more along the lines of:
CREATE FUNCTION myFunct (IN var text...) RETURNS boolean AS $$
BEGIN TRANSACTION
UPDATE table 1.....
UPDATE table 2.......
UPDATE table 3..........
COMMIT;
END;
$$ LANGUAGE plpgsql

Is that possible to do?
 
but while I care about them most as using them in t-sql, any good reading is appreciated
 
@MikaelEriksson interesting - I'll need to learn more about that.
 
@unseen_damage As we implied yesterday. WHy not just?:
CREATE FUNCTION myFunct (IN var text...) RETURNS boolean AS $$
BEGIN;
UPDATE table 1.....
UPDATE table 2.......
UPDATE table 3..........
END;
$$ LANGUAGE plpgsql
 
and then just run the function, with mode autocommit?
 
@MikaelEriksson thank you!
 
@MaxVernon Inline TVF is treated like a view by the optimizer and well "inlined" in the query :).
Before optimization.
 
@MikaelEriksson yah, I've been comparing the inline TVF proposed by @AndriyM compared to my non-inline TVF. Looking at my plan, the details of the TVF are hidden by the "Table Valued Function" operator, whereas his plan just shows the "normal" query operators such as table scan, and nested loop joins, etc.
so the takeaway from a plan-perspective appears to be "if you see a table valued function operator in a plan, that's A Bad Thing™"
 
@MaxVernon Sure, or at least "please have a look at why I'm here".
Unless you do XML queries. Then they are all over the place making little sense.
 
1:04 PM
@MikaelEriksson ...to anyone but you, you mean :)
 
@MikaelEriksson lol. Thanks for that heads-up! do you have an answer on here that shows any of that stuff?
@AndriyM I upvoted your CW contribution on that palindrome question - although I don't get why you made it CW.
 
@MaxVernon You mean the XML things? I have answered a couple yes.
 
@MikaelEriksson yes. I'd love to look at one so I get what you're talking about in slightly more detail.
 
@AndriyM I find it challenging and interesting to figure out what they do and why. Not easy.
@MaxVernon Could this be of interest? stackoverflow.com/questions/24196516/…
 
@MikaelEriksson yes, looks interesting. Thanks! I'll read it in detail momentarily!
interestingly, comparing execution statistics for my multi-statement TVF vs the inline TVF, the inline TVF is taking a lot longer to run.
not at all what I expected
statistics times:
Multi-Statement: CPU time = 62 ms,      elapsed time = 228 ms.
Inline:          CPU time = 113288 ms,  elapsed time = 113970 ms.
I must be doing something wrong
this is the inline-tvf:
CREATE FUNCTION dbo.InlineIsPalindrome
(
	@Word NVARCHAR(500)
)
RETURNS TABLE
WITH SCHEMABINDING
AS RETURN (
	WITH Nums AS
	(
	  SELECT
		N = number
	  FROM
		dbo.Numbers
	)
	SELECT
	  IsPalindrome =
		CASE
		  WHEN EXISTS
		  (
			SELECT N
			FROM Nums
			WHERE N <= L / 2
			  AND SUBSTRING(S, N, 1) <> SUBSTRING(S, 1 + L - N, 1)
		  )
		  THEN 0
		  ELSE 1
		END
	FROM
	  (SELECT LTRIM(RTRIM(@Word)), LEN(@Word)) AS v (S, L)
);
GO
 
1:14 PM
More here on what could happen for tvf's dba.stackexchange.com/questions/104192/…
 
@AndriyM - that is your code just wrapped in a CREATE FUNCTION statement, and I had to replace the SELECT * with SELECT N ;-)
 
@MaxVernon I've added nothing to Martin's idea. I didn't even intend to answer, but Paul nagged me, and who am I to oppose Paul?
 
@AndriyM ahhhhh
 
I mean, I posted that as a comment at first
 
right
 
1:18 PM
#Sysadmin #Truth #Backup #Unix #Linux http://t.co/suCT9ME58V
 
hello, @Marian!
 
hi @Max :)
 
@AndriyM we'll call you Timothy from now on ;)
 
@ypercubeᵀᴹ Er, this must be some kind of reference, which I'm failing to recognise :)
Or remember
 
@Marian that's genius. "Schrödinger's backup"
 
1:20 PM
yeah, liked it too, thought it's worth a share
 
@AndriyM perhaps that was about the CW
 
@ypercubeᵀᴹ Oh, I see. Different Pauls, but perhaps there's something in common :)
 
@MaxVernon I did this.
select top(20000) c1.name+reverse(c2.name) as name
into #words
from sys.all_columns as c1, sys.all_columns as c2

select *
from #words
cross apply dbo.InlineIsPalindrome(name)

select *
from #words
cross apply dbo.IsPalindrome(name)
And got 140 ms for the inline version and 1600 ms for the multi statement.
 
strange. I'm prepping a question with the full details.
 
IsPalindrome is the one from your deleted A.
 
1:31 PM
right
 
A_V
I like the smell of the oracle database 7 running on an old nt4 server crashed in the morning
 
@A_V wow
 
@MaxVernon Nice. I have only 10000 rows in my numbers table. Could mean something, sometimes.
 
@MikaelEriksson my test table has 16500 rows.
hmmm
 
SQL Server 2014, Old or new estimator makes no difference.
 
A_V
1:35 PM
talk about stretching systems for too long
 
@MaxVernon It depends on the data. With a lot of matches the multi statement is the winner.
 
2:24 PM
@MaxVernon I don't think your Numbers table has only 16500 rows if it's doing 1.2million logical reads?
 
@MarkSinkinson the row count comes from a cross join of sys.objects with itself on my Test database. If I do SELECT COUNT(*) FROM #Words it now says 17161, because I added some other objects to the database.
 
@MaxVernon Sorry, I think you're talking about your Words table, I'm talking about your Numbers table.
 
@MarkSinkinson oh. yes. ooops. I meant to indicate the #Words table had 16500. very sorry about that!
 
@MaxVernon The smaller the Numbers table, the more optimal the query appears to be (unless an index is added)
 
@MarkSinkinson agreed. I'm just trying @AaronB's suggestion of limiting the numbers in the CTE using WHERE number <= LEN(@Word)
also, I've added a primary key/clustered index to the Numbers table, per Martin's comment.
 
2:47 PM
5
A: How to switch/disable functionality of fn keys on Ubuntu - USB keyboard

Tomasz Cy-man this is the best solution what i found ;-)

 
3:04 PM
Anyone want to take a crack at this?
http://stackoverflow.com/q/37075628/2697001
 
Very good edit, @AndriyM
0
Q: Separate letters from digits in alphanumeric string

user93438I have an alphanumeric string as input and I want to get two results out of it: a string where all the numerals are removed and an integer that is the sum of all the digits in the input string. For instance, for this input: GR35hc7vdH35 I want the following output: | Col1. | ...

I had a really hard time understanding the post (almost flaged as unclear what you are asking), but now it's quite clear.
 
cough vote cough
 
@MDCCL It didn't look awfully unclear to me but I could see how OP's lack of explicitness could be making it difficult for someone else to get what the issue was.
 
3:40 PM
3600 views in 2 days on the palindrome question.
 
@MaxVernon has been twitted
probably is on the SO network "hot" list as well
T-SQL : Is string a Palindrome? http://dba.stackexchange.com/q/137388?atw=1 #sqlserver
 
In case someone hasn't seen it already, I find very funny the following DBA-related Twitter account:
@DBAReactions
I keep a webcam on my monitor, and when bad things happen, I post my reaction.
5.3k tweets, 3.1k followers, following 9 users
 
that's a classic by the @BrentO team
this one is fun:
When my manager offers me some helpful constructive criticism http://ift.tt/23iRNom https://t.co/Bsfp3mAFqR
 
A_V
3:56 PM
"I keep a webcam on my monitor, and when bad things happen, I post my reaction."
does he really do that ? Don't see any
 
4:29 PM
@MaxVernon Did you notice Table '#A1CE04C3'. Scan count 16896, logical reads 16900 in your msTVF test?
 
@PaulWhite I did look at it, yes. Unsure what to make of the scan count.
I know its a lot of scans. ;-)
 
@MaxVernon That's the table variable @t in the msTVF being created, and written to (one row!) for each execution.
If you still have the test rig, try capturing execution plans using Profiler.
Seriously, try it.
You'll get a complete execution plan, inserting one row to the table variable for each row in the #Words table. A complete execution plan for each row.
That is what @MikaelEriksson was alluding to with the 'execution context' remark, though it's worse than just 'switching context' in the sense of evaluating permissions.
The overhead is similar to executing a completely new query for each row.
So when I said it was no better than the scalar function, I meant it was worse.
Instead of executing a query per row, you're now executing a query per row, putting it in a temporary table variable, waiting for the client query plan to read that row from the table variable, dropping it, then repeating for each row. Yikes, right?
 
4:46 PM
That is just the kind of weighing in I was silently hoping for.
 
Sorry I was asleep :)
 
5:00 PM
My results with ~60k rows in #Words: msTVF: 14,645 ms; iTVF: 674 ms.
 
@PaulWhite And now everybody else is.
it seems
 
@AndriyM Yeah. I'm trying very hard to believe it is not a conspiracy :)
 
Maybe they are all answering or otherwise watching this one:
6
Q: Separate letters from digits in alphanumeric string

user93438I have an alphanumeric string as input and I want to get two results out of it: a string where all the numerals are removed and an integer that is the sum of all the digits in the input string. For instance, for this input: GR35hc7vdH35 I want the following output: | Col1. | ...

 
OMG we're turning into Code Golf.
@AndriyM I blame whoever improved the question.
Ha ha
 
Ha ha
 
5:15 PM
Makes you wonder what the background is.
People never cease to amaze me with the dumb stuff they want to do inside the database.
 
Maybe some kind of ranking, for string sorting, but then why summing up the digits?
 
Whatever it is, it should probably be done before the data hits the database.
 
You're an absolute lifesaver, thank you so so much! This solution wrote a 140k+ record set to CSV in just a few seconds. I'll post the VB.NET version of the code in a separate comment in case it's helpful to anyone in the future. You're the best!! — Kel 14 mins ago
I'll add that I'm a lifesaver to my CV now
 
@PaulWhite sorry I was at lunch. Yes, yikes. I'm going to try using profiler. Thanks for explaining it!
 
5:33 PM
@billinkc I'm trying to imagine something more offensive than VB code in a comment.
 
@PaulWhite They probably had similar thoughts and consequently posted their code as an answer.
 
The cynic in me says they only did that because the comment box was too small.
Still, upvoted both.
 
Pretty sure I heard Conor Cunningham say "don't do bitcoin in the database". Don't know why he was so against it, maybe commercially, or just because it's a stupid thing to do.
Either way, he was really against it lol
 
Unusual for Conor to have a strong or controversial opinion.
 
@PaulWhite lol I love Conor, so dry.
 
5:39 PM
Yes me too.
 
@PaulWhite ok, that is eye opening.
 
The question is specifically about using master..spt_values to split strings. I'm sure there are more generic questions about string splitting in SQL Server, which is where I believe this answer should belong. (And then you could just post a link to it in a comment to this question if you wanted to draw people's attention to the new feature.) — Andriy M 35 secs ago
 
@MaxVernon Everyone should trace a multistatement TVF at least once in their lives. They're not always a bad idea, but usually. The valid use cases are rather small, but probably larger than scalar functions as implemented today.
 
@PaulWhite it seems to enforce to me the value of testing several ways of skinning the cat before deciding on the exact method to use for that particular cat.
 
@AndriyM If only there were some way to express how we feel about a question/answer.
Something ... democratic.
 
5:51 PM
@PaulWhite ^^ This is a great idea - how about a conch shell? ^^
2
 
@PaulWhite I think you should try being a little clearer.
Apr 28 at 19:44, by Paul White
I cannot stress how important votes on questions and answers are, both up and down.
 
@wBob To meta!
 
this to be filed under things you probably didn't want to know
 
To be fair, the conch shell did not work out well for Piggy.
 
@MaxVernon Not clicking.
 
5:59 PM
@MaxVernon I thought that was primarily about DBA.SE.
Although I'm sure Paul is a generous person and would probably not mind for that statement to be extended to other sites as well, even to SO. Sometimes.
 
@AndriyM sure; however it applies equally (more?) to Stack Overflow
 
The function 'reverse' is not supported with natively compiled modules. Or the UK government. Oh hang on, no sorry, yes it is supported fully by the UK government.
 
4
A: Blockchain (Bitcoin) as a database?

Ali RazeghiI'm very familiar with cryptocurrency and databases, and I can tell you it's not a great DB engine at all. Think of it as a first normalized form without any really good built in search capability or indexing as far as the blockchain goes. Basically a excel sheet without any computation capabil...

@wBob I thought you were being random earlier.
 
@PaulWhite I do have form for that.
 
Ha!
 
6:11 PM
@PaulWhite what's with the scan count being 4 less than the number of rows in the #Words table?
 
The things I do to make others happy...
 
@MaxVernon Don't know. Blame caching :)
@billinkc Allan Hirt is never happy.
 
Were he to see that post (or the referenced MSDN) article in it's space free ... I'm afraid we might lose him to apoplexy
Well, he's probably more frustrated with the MS piece than the user since they're just playing the mixed message
 
If it hasn't happened yet... :)
 
6:27 PM
@PaulWhite interesting
I love the fineprint on that page
 
@MaxVernon Honestly I have no clue. In the last test I ran it was only 1 short.
(59536 row(s) affected)
Table '#BBAB2460'. Scan count 59535, logical reads 59536
 
@PaulWhite so weird. you'd think it would be more deterministic than that.
 
Hm that 'fixed font' button looks new.
@MaxVernon Actually, I wouldn't. The number of weird little discrepancies between stats io/profiler/xe/... over the years, I've given up being interested.
 
@PaulWhite good point.
 
Apparently counting is hard.
 
6:35 PM
apparently
 
7:06 PM
Creates SQL 2016 in-memory scalar Palindrome function, doesn't check results << that's how I roll.
 
So long as it's fast, who cares?
 
@PaulWhite lol
 
Clearly the optimal solution is to load a column store table with all possible palindromes.
In-memory column store of course.
 
Can't drop [any palindrome] because it's being referenced by universal.palindrome.
 
7:22 PM
@PaulWhite with hashes of all possible palindromes ;)
 
Plus palindrome family, status of palindrome, effective date etc. In the future, the status of some particularly long palindromes is in dispute as no computer is able to determine effectively whether or not it is indeed a palindrome. A quantum computer was asked, but it say "maybe".
 
@wBob however, it's successor computer immediately produced the irrefutable answer of forty-two.
 
7:39 PM
And then forgot the question
 
8:06 PM
@MaxVernon Battlelines are drawn as the Association for Rights of Sentient Palindromes square up to the People Against Palindromes organisations. Incumbent president of United States admits a palindrome could win the next election, new religions spring up around messages hidden within palindromes, deep within ...
 
No marks will be awarded as the preceding sentence was not a palindrom
 
@wBob nice
 
9:08 PM
@MaxVernon I edited your answer with your removed query, making a slight correction (and rolled back to hide it again ;)
Not sure if you want that version. But to me it seems like a good one.
A very good one.
If you roll back to revision 3, future readers will think we've been on a (very strange) edit war!
 
9:53 PM
Spare 3 close votes? User's been back but not provided any updates stackoverflow.com/questions/37027346/…
 
10:51 PM
@ypercubeᵀᴹ nice one, I was going to do a cross apply but it just seemed easier as a CTE.
I like your version!
 
11:08 PM
Using mysql 5.6: I'm running a CREATE TABLE foo AS SELECT * FROM bar WHERE x > y, and I did a COUNT on that result set previously, and it came to 227 651 192 rows (3 integer columns and 1 binary(16)). Now it's been running 50 minutes, the foo.idb just stopped growing at "9.7G" and has been stuck on that size for 10 minutes. Any ideas? SHOW PROCESSLIST is showing "Sending data"
TIL about SHOW ENGINE INNODB STATUS\G
 
@ErikPerik How many rows does bar have?
 
11:25 PM
unknown really, the size on disk for that table is 81GB
SELECT DATA_LENGTH/AVG_ROW_LENGTH from INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'bar'; returned a 632_219_012
 
Is it InnoDB table?
 

« first day (1949 days earlier)      last day (2919 days later) »