« first day (1211 days earlier)      last day (3664 days later) » 

12:03 AM
@PaulWhite That works.
 
0
Q: Advice on creating a forum website using asp.net

Brian JI'm planning to start developing a forum website this summer and I'm looking for some advice on what technologies to use and best methods. I have already completed modules at college in asp.net and ado.net but I haven't been shown how to provide user authentication and creation. My questions ar...

Needs 1 more kill
A quick headshot
 
@FreshPhilOfSO Boom.
 
@MikeFal @MikeFal gains 10 XP
GIVE IT A TRY !!! !!! !!! © 2014 Rolando
 
1:03 AM
Another that needs killing:
-1
Q: "general_logs" is not writing more record,

adenisdeveloperI wonder why my data inside my "mysql" table "general_log" is not writing more record, stock given the last day was yesterday 04/27/2014. My my.cnf file is as follows: [mysqld] open_files_limit=84138 binlog-do-db=cartaodo binlog-do-db=todasuac expire_logs_days=25 [mysql] ...

Concatenating nothing with something produces the same something. If you make a meal of just cheese and add nothing else to it, what do you have? The fact your empty hand moved towards the cheese doesn't change that. — FreshPhilOfSO 24 secs ago
I'll get my coat....
 
Then how about select 'taco' +; ? Why is it not equivalent to + 'taco'? — Binaya Regmi 1 min ago
 
1:20 AM
I think it's cheese time. Opens fridge
 
@gbn question for you regarding
93
A: Why use the INCLUDE clause when creating an index?

gbnIf the column is not in the WHERE/JOIN/GROUP BY/ORDER BY, but only in the column list in the SELECT clause. The INCLUDE clause adds the data at the lowest/leaf level, rather than in the index tree. This makes the index smaller because it's not part of the tree This means it isn't really useful ...

At SQL Saturday, @brento mentioned that using INCLUDE is no better than including columns explicitly in the index definition
Is there any real reason to use INCLUDE? (question for all)
 
It's not much better. You know that indexes are a tree, yeah?
include only puts the included columns at the leaf level, which means you can't use them to sort or filter on
but it does save a little space
 
1:53 AM
kidding aside, yes I do.
 
2:24 AM
@SimonRigharts and can save you a ridiculous amount of CPU and RAM if you can cover key lookups :)
 
2:51 AM
@swasheck True, I was comparing including a column vs. putting it in the key when I was saying 'save a little space'
 
;)
 
Also the other thing is you can include columns that won't fit in the key (996-byte keylength restriction + you can't key on LOB types)
 
that's a feature to keep fools from shooting themselves in their gonads
 
@swasheck Make something foolproof, someone will find a better fool
 
most of them are employed on the dev teams here
 
 
4 hours later…
gbn
6:39 AM
@Kermit I disagree
Example: I want the NC index to be unique. Adding the INCLUDES to the key bollixes this because I have extra columns now. Or I add another index to enforce uniqueness... not.
@SimonRigharts and this
@swasheck and this
@Kermit Brent said this? Well, I've had disagreements with him before on this site in answers.
 
 
2 hours later…
9:05 AM
I say the syntax is allowed because the parser's programmers were lazy. Another, even more silly example: SELECT 'tako'+++++++++++++++' with cheese';ypercube 1 min ago
 
gbn
@ypercube interesting
 
@gbn It takes 491 + for the parser to complain: sqlfiddle.com/#!6/d41d8/17120
> Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.: SELECT 'tako' +++++++++++++++
 
gbn
9:26 AM
@ypercube slow day then? :)
 
@gbn Just had coffee. waiting for some logs to be analyzed
How is the weather there? Sunny?
 
gbn
9:56 AM
@ypercube yeah
A little cool after the glorious weekend, but still shorts and t0shirt
@ypercube How is the UK for you?
 
@gbn Actually, if certain columns already form a unique key, expanding that key with more columns will not eliminate the uniqueness. (Or maybe I misunderstood your point.)
 
gbn
@AndriyM col1, col2 are unique
add col3
col3 can be any value
(col1, col2, col3) is unique now which allows more combinations than (col1,col2)
so the (col1, col2) uniqueness is lost
for current data, this key expansion is OK. (col1, col2) are unique within (col1, col2, col3)
but someone can add another(col1, col2) combination with a different col3
(col1, col2) is no longer unique
so uniqueness breaks generally when expanding the key. So use INCLUDEs
 
10:52 AM
Ah, yes, I was thinking only in terms of current state of data. Of course, a unique index is not just an index but also a constraint and adding more columns would change that constraint in a way that the former key would no longer be guaranteed to be unique. That's what I didn't think about.
 
@ypercube My suspicion is that the parser treats a(ny number of) leading + characters as a unary plus, which has no effect on anything and so is ignored. Strictly, unary plus only applies to numerics, but + is so overloaded in Transact-SQL it's hard to know.
@gbn Brent says a lot of things, including things that are controversial. In context he is usually correct, or at least arguably so. My guess would be he was saying includes add little over keys for non-unique indexes.
 
gbn
@PaulWhite Quite possibly. You can know so much/be so close to something it's hard to step back
 
@gbn I acknowledge that possibility ;-)
@gbn P.S. Where are you at the moment?
 
11:14 AM
@PaulWhite the knights' island
 
Um?
 
Malta
 
Oh. I thought he was always there. As in that's where gbn lives?
Clearly I read something into an earlier message that wasn't there :-/
As you were :)
 
@PaulWhite INCLUDE looks useful, I wish postgres had it
 
@JackDouglas Does it not? That's unusual. I usually think of Postgres as being ahead of SQL Server. With the exception of native parallelism.
 
11:17 AM
it's more rational imo than any of the others, but it lags on 'enterprise' features in particular
 
@PaulWhite They miss clustered indexes as well.
 
it's ahead in some niche areas like exotic indexing
 
@JackDouglas And almost every programmer-useful thing I have ever wished was in T-SQL.
@ypercube Really! I need to reevaluate my PG opinions it seems.
 
T-SQL seems like a strange beast to me, more of a scripting language than a programming language?
 
Don't ask me to define T-SQL. It is what it is, and I have no idea why.
Probably backward compatibility. I blame most stuff that makes no sense on that.
T-SQL is interpreted though, if that's the emphasis you were looking to put on it.
(unless it's in a Hekaton native compiled procedure)
 
11:21 AM
PL/SQL is interpreted too but it's much more 'languagey' than T-SQL
 
Ah. Ok.
 
@ypercube you can achieve clustering with a covering index
not quite the same thing sure
 
gbn
@PaulWhite I turned down a contract in Switzerland recently. Bad climate for contractors in banking. But I'm still in shorts and t-shirt at the office in Malta
@JackDouglas Oracle and PG separate SQL and Programming aspects a lot
 
@gbn That explains how I became confused I think, thanks.
 
gbn
Sybase and SQL have merged the two into one language :T-SQL
MySQL is still an etch-a-sketch in comparison ofc
 
11:33 AM
You do have the option of CLR programming within T-SQL, but it's not quite as integrated as we might hope, and the whole DBA vs Dev thing means crossover hasn't been great.
 
gbn
@PaulWhite "Do it in the database" may suddenly mean "deploy this 500MB aseembly"
@PaulWhite See my "combined" vs "separated" comments above please
 
Right. T-SQL lacks a way to write .NET code within SSMS, so it is quite "separated" in that respect. More to the point, not many DBAs can/want to write .NET code.
I pity anyone that ever has to migrate a database from one platform to another.
Standard SQL. LOL.
 
@JackDouglas I don't believe I understand the difference between a script and a language, but anyway, what specifically is not so languagey about T-SQL?
 
gbn
11:50 AM
@PaulWhite Like the java-anal sex joke.
 
@gbn Say what now?
The weather in Malta does look pleasant by the way.
Is there a badge for not being aware of any meme ever?
 
gbn
@PaulWhite Saying Java is best because it runs on any platform is liek saying anal sex is better because it fits any gender
 
Yikes. So glad I asked!
 
gbn
@PaulWhite Way better than the UK.
 
Ha. Uncyclopedia is amusing.
 
gbn
11:55 AM
Where are you just now? Awfully late for NZ
 
My wife's going to be in the UK shortly. On previous trips, her flight marked the exact moment NZ went into Winter and the UK hit record summer temperatures.
@gbn 11:56pm Tuesday. Just getting started :)
 
gbn
@PaulWhite ha ha "record UK temps"
 
Record highs I should say. And yes, context is everything.
Ugh. Someone barfed code onto the main site.
-1
Q: Tuning Slow Performing Queries

user37722I have a query which is taking too long to execute. I used database tuning advisor to check this query and it suggested some missing indexes and statistics. The problem is I can't create missing index and statistics on those tables because it will slowdown insert/update and affect other scripts...

Pretty much every major code smell in there.
Except XML.
 
Hey, I heard that.
And here.
0
Q: Tuning Slow Performing Queries

user37722I have a query which is taking too long to execute. I used database tuning advisor to check this query and it suggested some missing indexes and statistics. The problem is I can't create missing index and statistics on those tables because it will slowdown insert/update and affect other scripts...

 
@MikaelEriksson I was just testing your reflexes :)
2
Cross-posted as well. Of course.
 
12:19 PM
Which way should it go then?
The SO one's got an answer already, so...
 
@AndriyM it feels to me like a series of sql statements with some procedural extensions bolted on, whereas PL/SQL is an ADA-like language with the ability to execute SQL statements. This seems to sum it up.
both ways have their advantages, I'm not doing one down
that said, I far prefer procedural programming in postgres than either
 
@AndriyM Far too low quality to live here. Probably acceptable to SO. Nuff said.
 
I thought of closing as "Off Topic - Tip of the iceberg" only there already is a full iceberg of code in the question.
 
12:58 PM
@gbn got it
@gbn yeah, at sql saturday.. there may be some context missing around it, such as if it's NC or C
 
gbn
@Kermit Clustered indexes can't have includes
Their structure means all non-key columns are included as a matter of course
 
Then all we have left is NC
 
gbn
@Kermit Indeed
 
And I definitely didn't mishear him
 
gbn
It matters little for a non-unique NC index as discussed above. But a lot for unique NC indexes
 
1:04 PM
Interesting
 
gbn
@AndriyM @Kermit follow this back. Sorry @AndriyM
Except for the 900 byte limit of key columns of course
 
Also, where you have you and Brent disagreed?
 
Recursive follow back ... stack overflowed
 
gbn
So, on balance, always use INCLUDE where possible....
@Kermit Somewhere here. About service accounts per install or generic
At least
In other news, do we still have an invisible mod?
 
How would we know?
 
1:07 PM
@gbn we're all invisible now ;)
 
gbn
The non-participating mod then
 
@gbn we're all mods
 
this is a communist chat room
@gbn otherwise, he's not nuts right
 
gbn
@Kermit As Paul said above, he could be misunderstood,
 
1:16 PM
@gbn that's more likely
 
gbn
@Kermit Define communist. Marxism? Trotskyite? Leninism? Bolsheviks? Mensheviks? Maoist?
Facism has many forms
 
@gbn Castroism
 
gbn
@PaulWhite Indeed....
I've just realised that Mr Denny's picture is a caricature of my Avatar
 
@gbn also RAID10 the lot v separate logs? or was that @Mark?
 
gbn
@JackDouglas could be. I think that guy had limited disks so "ideal" was not available
 
1:27 PM
yes, it was 6 or something like that iirc
 
@gbn how about "always sort in the app, never in the database"? #2 here: brentozar.com/archive/2013/02/…
 
@AaronBertrand yeah he mentioned that in his session
 
I think sometimes he forgets to qualify statements. None of these things he's saying are always true - that's simply not possible. Are there situations where they make sense? Of course. Are they situations where - were you to implement his suggestion - you would really wish you hadn't? Absolutely.
2
 
@AaronBertrand how dare you say what he say is not say
 
It's quite deliberate I'm sure.
 
1:32 PM
How dare you say I take money
 
@AaronBertrand wow. interesting that he bases that fundamentally on license costs so it depends on your RDBMS
 
@PaulWhite oh absolutely - controversy draws traffic
@JackDouglas it's also very specific to applications that can implement an app-layer caching easily, and don't need real-time results. If you are paging Amazon's inventory it's quite unlikely you're going to want to send all 500 million keys to the client and then sort on slightly cheaper CPUs.
It also assumes your workload is CPU-bound. I come across a lot of workloads, and not many are CPU-bound.
 
@AaronBertrand yeah, equally unlikely you are going to want to implement locking in the app level for all that cached data if there are updates going on
 
Exactly, and for an online shop there are always updates (e.g. to inventory levels)
 
unless you are Java EE of course spit
 
1:36 PM
There are definitely some use cases, but he comes off like this is an "always do this" thing
And unless Kermit misinterpreted, he's done it again with this "don't bother ever using INCLUDE" thing
 
208
A: Database for ENORMOUS amounts of data?

Brent OzarAs a DBA, here's the real answer. The best database platform in the world can be unable to handle the tiniest of loads if you don't have staff that knows how to use it. A fairly low-end database platform can scale up to huge loads if you have staff that knows it inside and out and works around ...

 
morning heapers
 
gbn
@Kermit Some of us do stuff every day, quietly. Some of us talk about it
@AaronBertrand I'd use the best tool for the job in hand, based on what I'm trying to do. I'd take advisement by reading stuff like that, but I'd consider things based on my shop
Now, I'm a BI DBA with a few TBs of data and lots of ETL. Few app servers. Qlikview and Cube presentations layers.
 
@AaronBertrand Say what now? I missed this one.
 
gbn
Sort in app kinda by default
 
1:49 PM
For sure. But he's a powerful voice and there is a large segment of the community - at least I think - that follows every word he says.
 
gbn
Last gig, game developer DevDBA. Lots of app servers, real high volume OLTP, no need to order by per se
 
12 hours ago, by Kermit
At SQL Saturday, @brento mentioned that using INCLUDE is no better than including columns explicitly in the index definition
 
@AaronBertrand was just about to reference that
 
gbn
@AaronBertrand Take note @Kermit, Uncle gbn and Auntie Aaron will look after you
 
@gbn Great... so you might be interested in helping me un-fudge a FUBAR'd QV implementation in the future? :)
 
1:50 PM
That statement needs a lot of qualification.
 
thanks uncle @gbn and auntie @AaronBertrand
 
@AaronBertrand It sure does
 
And I wasn't there, so I don't know the context. But if that's what Kermit remembers, I'm sure that's what half the room took away, too.
And that's a shame, because that's a bad commandment to suddenly start living by.
Maybe a canonical Q&A about when you would use INCLUDE
And also one about "never say never, because that's stupid."
 
Here's the INCLUDE slide that was used as part of the discussion
And @AaronBertrand 's favorite
 
@Kermit He seems to have change the wording though.
From "always" and "never", to "avoid"
 
2:00 PM
@ypercube so that's a good thing
 
So that's a non-unique index, which is good, but if he didn't specify, that's bad
Also what is the point he is making? The arbitrary order the data is returned in if you did a SELECT without ORDER BY and it used the index?
 
@AaronBertrand don't recall
 
Not a very effective slide then, eh? :-)
 
@AaronBertrand how dare you...
 
@AaronBertrand The session introduces complex topics in a way that maximizes the chances of future consultancy work.
To answer more seriously, that part of the session appears to be a basic introduction to how indexes can avoid the need for an explicit sort.
i.e. without the index, the engine scans the clustered index, filters, then sorts.
 
gbn
2:11 PM
@PaulWhite So cynical in one so young. Breaks my heart.
 
@gbn Not at all. It's a very valid business model.
 
gbn
@Kermit Let's change a column to nvarchar(2000) to capture some notes. Can't add to key. I would personally make that unique too because it includes ID. More information for the optimiser. But anyway, it's misleading.
 
Where "consultancy work" includes "paid training videos".
 
gbn
@PaulWhite I'm not a consultant: I don;t have the temperament etc
 
@gbn Note I didn't say it's my business model :)
 
2:13 PM
@JackDouglas That really outlines it well for me, thank you. And I also went on to read a little on the whole "scripting vs programming" thing (should have done it before asking my question), just to be sure what's the general agreement on the difference is. And now I've got a clear picture of what you meant, so, thanks again.
 
gbn
@MarkStorey-Smith If I can't, I know some folk who do more QV than me. I administer it mostly. I have code monkeys to dig around QV
 
@PaulWhite interesting POV
 
@gbn Does the implementation there talk to a DW or is it the car-crash mess of pulling data direct from OLTP systems that I'm looking at?
 
gbn
@MarkStorey-Smith It talks to marts, DW and cubes. A minor shunt, not a full car crash
but that's because it grew very rapidly. now it's being tamed
 
So after thinking about it for a bit I think Adam Machanic had my favorite presentation on Saturday.
 
gbn
2:20 PM
@MarkStorey-Smith Is there a DW in the middle? Or is that phase 1 of consultancy?
 
I rarely add large columns as includes to an index because it can easily become counter-productive. I like my indexes narrow.
@Zane Row goals?
 
gbn
@PaulWhite me too. It was an example.
 
@PaulWhite Yup
 
@gbn I know. It's just interesting to think about genuinely good uses for INCLUDE on a non-unique nonclustered index.
@Zane What did you like about it?
 
gbn
@PaulWhite Eliminations of scans, they become seeks. Key lookups are removed mostly. For OLTP
 
2:23 PM
@gbn I've been building a DW (small enough to qualify as a mart so far) for one side of the business, the other side has QV with hooks into 10+ odd OLTP systems and is also in service as an ETL tool for some outbound customer data feeds. It's lovely.
 
@gbn I mean genuine uses for include as opposed to adding to the keys.
 
gbn
ah
 
Well for starters I loved the way he kept reminding people that you shouldn't just go around doing this all over. There were a few audience member who seemed to think he was suggesting TOP = magic and his handling of those people was brilliant.
 
I like it to avoid unnecessary Halloween Protection.
 
Mainly though it was brilliant and got me thinking about the optimizer differently I've already used the technique with positive results.
 
gbn
2:25 PM
not sure I get you: I've used them in OLTP queries to get better plans and consistent response times.
 
@Zane I haven't seen the slides. Is it the whole TOP (@N) ... OPTION (OPTIMIZE FOR (@n = 5000) thing?
 
gbn
More recently, some ETL loads have benefited from them
 
@PaulWhite That's part of it.
There are a heap of times where we are looking for loans based on x funding date. So there are many places people use a query to get that funding date and then go collect all of those loans.
 
@gbn This is what I am saying: when a covering index is what you want, you have a choice between adding a column to the index key, or having it as an include. Putting it in the include has a few benefits, one being that Halloween Protection in DML plans is only required for key modifications, not includes.
@Zane Right, and how does a row goal come into that scenario?
 
2:29 PM
However even though the query will only return 1 funding date SQL Server doesn't know that it's using the stats and giving back 3K estimated rows. If I top 1 that query now it's estimating one and the downstream effects are surprisingly fantastic.
 
gbn
@PaulWhite I never thought that deep. To me, it's just clear separation of key and data, better query plans, slightly more efficient B-tree, and consistency (why have some INCLUDEs, some in the key?)
 
@Zane I see. So you have a big query with a complex plan and inaccurate estimates, and shoving a TOP (1) somewhere improves things? Fair enough.
 
@PaulWhite Well I wouldn't say that.
I'm using a TOP where I know only 1 result will be returned.
 
Any time I use top 1, I know 1 result will be returned :P
 
@Zane Oh. So you have a plan that would be great if the query actually returned heaps of rows, but it's not great for the one row you know will be returned. Ok.
 
2:34 PM
@billinkc any time i use TOP 0, I know none to 0 results will be returned
 
Sounds like vertica voodoo to me
 
@billinkc Vertica uses LIMIT .. muahahah
 
@Kermit So in Vertica, even if you issue TOP 1, there will be none to 0 results, right?
 
@AndriyM that's not valid syntax
Vertica is based on PostgreSQL
 
@Kermit That's what I was saying
 
2:38 PM
ERROR 4856:  Syntax error at or near "1" at character 12
LINE 1: SELECT TOP 1 * FROM ...;
 
@Kermit See? No results then
 
@PaulWhite It's a scenario where it's SELECT Blah From LoanTable WHERE BlahDate = (SELECT TOP 1 MAX(WhateverDate) from Sometable where criteria = x) This is obviously an oversimplified example however I know ahead of time that the sub query will only return 1 row but the estimate is much higher than that. So I add that top 1 and now the estimated row size is only 1.
 
@AndriyM i may have not conveyed my sarcasm
 
@Kermit I should have made it more clear that I was messing with you, sorry.
 
@Zane Yes, that's what I was trying to say (though that's a terrible example query because MAX without GROUP BY can only ever return one row).
 
2:40 PM
@AndriyM my feelings have been hurt.
 
How dare I...
 
@PaulWhite Yeah well it gets the point across. I'm getting the feeling that you're against this approach.
Is there some consequence to this approach that I am unaware of?
 
@Zane I see one of the demos uses TOP (1) on a MAX to prevent an optimizer transformation to a different kind of join. Yes, in general I'm against it. I prefer to write queries that do not fight the optimizer, or rely on things that happen to have some desirable effect today, but which are not guaranteed to work in future.
I say "prefer" for a reason. I have used the same sorts of tricks in real queries, but only when there was no sensible alternative, and right-now performance was more important than maintainability.
 
I don't plan on just pushing this strategy all over the place and don't plan on telling my coworkers of this strategy. The way some of them use the tools they already have frighten me.
I see where you're coming from and don't disagree, however in this scenario I feel pretty confident that it won't bite me in the ass, and it's definitely fun to play with.
 
3:00 PM
@Zane But the only thing you changed was to put a TOP 1 in front of the MAX. That happened to give you a different plan. What if the next version of the optimizer sees through that trick (as it does for TOP 100 PERCENT) and you get the old slow plan again?
Why, for example, wouldn't you prefer to execute the subquery and store the result in a variable, then execute the outer query with ... WHERE BlahDate = @BlahVariable OPTION (RECOMPILE)?
It's a bit like the "intermediate materialization" example with TOP (big_number) where a simple change to the query does the same job, without any silly tricks.
i.e.
WITH y (ManagerId, theCount) AS
(
    SELECT p.ManagerId, COUNT_BIG(*)
    FROM HumanResources.Employee p
    GROUP BY p.ManagerId
)
SELECT x.EmployeeID, COUNT_BIG(*) AS TheCount
FROM HumanResources.Employee x
JOIN y ON y.ManagerId = x.ManagerId
GROUP BY x.EmployeeId;
Four logical reads.
 
Well technically this isn't even going out because I'm using GETDATE() functionality instead.
 
I'm glad you enjoyed the session, and took something useful away. I just have my reservations about promoting these "tricks" where some fraction of the audience may not be qualified to use them.
 
gbn
Right folks, I'm off home now. I should try and hang here more often.. again
2
 
Ugh. I'm trying pull up the variable version but Plan explorer is crashing on my garbage laptop.
 
@gbn Have fun in the sun :)
@Zane Don't bother unless you had an OPTION (RECOMPILE) on it and you're about to show me a post-execution plan.
OMG was he serious with that dbo.Many() function?
 
3:10 PM
@PaulWhite that's the idea.
 
gbn
@PaulWhite I saw that at SQLPass...
 
GRR I'm going to have to reboot again.
 
@Zane try kicking
 
@PaulWhite I definately agree with you there. Some of those people in that session that he was talking magic and in spite of him repeatedly saying. This is just a thing. It may be a good thing or it may be a bad thing. There were certainly people who came out of it with stars in their eyes.
I'm just kinda feeling it out in DEV and it's pretty interesting.
 
@AaronBertrand wait ... why's that good?
 
3:20 PM
@Zane Interesting? Yes. Sensible for widespread use? No.
 
@swasheck because INCLUDE is a bit pointless for non-unique indexes?
 
@JackDouglas i dont have the stamina to think through this right now ... i'm fighting our fsa provider
why is INCLUDE pointless
 
@swasheck idk, but I'm guessing because non-unique indexes don't tell the CBO anything clever about cardinalities.
@Paul ^^^ ?
 
@swasheck Brent was saying (according to reports) that there is rarely much benefit in putting a column in the INCLUDE list rather than putting it in the keys.
@JackDouglas Multi-column indexes do come with multi-column statistics (for the keys only). It's only average density information, but it can be better than nothing.
 
@PaulWhite ok. so why did aaron say that it was good that it was not unique (indexing being a severe weakness for me among my several weaknesses)
 
3:25 PM
@swasheck Because if it were unique, adding extra keys would change what was being enforced as unique.
 
@PaulWhite so turning your unique index to a non-unique to to make it cover some columns doesn't entirely mess up those statistics, but it is going to make them less useful?
 
@AaronBertrand Your reputation just saved me from several hours of unnecessary grief while updating an ancient SQL Server 2005 cluster! After an hour of troubleshooting, I saw a suggestion about pausing the inactive node and decided against it until I saw your name against a "this is the best way to do it" comment and thought, hey, if he says so, it must be true...
4
So thanks!
 
@PaulWhite oh. i see what you're saying. the uniqueness of each index is different if both are created as unique. i thought he was just saying on the INCLUDE version.
 
@JackDouglas I'm struggling to parse that.
 
@NathanJolly hey look, @AaronBertrand ... another satisfied customer
 
3:28 PM
I should point out that I don't have authorisation to pay for consulting services rendered 4.5 years ago
 
@PaulWhite if the optimizer knows that (a,b) is unique, then you take away that info and tell it that (a,b,c) is unique, it's got less accurate stats (because a,b is really still unique)
 
@PaulWhite I heard him say as much over the weekend.
 
@JackDouglas Ah, right, I see. Yes. But more importantly you obviously allow duplicates of (a,b) that weren't allowed before.
 
@PaulWhite εὑρίσκω!!!!!!!!!!!!!!! thanks
 
@PaulWhite I'm assuming you have another mechanism for preventing that (eg the unique bit is generated from a serial or whatever)
but yes, that too in general
 
3:34 PM
@JackDouglas That goes back to something gbn was saying earlier. If you have another constraint or index that enforces uniqueness for a subset of the changed index's keys, that may or may not be ok depending on the optimizer. Ultimately, it seems better to mark indexes that are actually unique as such, and to only have keys that are used to for uniqueness, sorting, and/or searching. INCLUDE is useful to make (some of) those distinctions.
 
@AaronBertrand Kevin Kline told me about new version of SQL Sentry today!
 
So (a,b) include (c) would be preferable if (a,b) is a key, even if a or b is also a key.
Ultimately, Brent's statement is technically true in some circumstances, but there will almost always be more important considerations. I certainly wouldn't recommend that people ignore the flexibility the INCLUDE clause provides.
 
@PaulWhite I'd never heard of INCLUDE before today (Oracle doesn't have something similar). I was looking for something just a day or two ago in pg by coincidence for a project I'm working on though. Ended up with a covering index non-unique and a unique PK which was a shame as space is tight
 
@JackDouglas Now your earlier comment makes sense to my limited parser :)
 
@PaulWhite If I recall correctly(and I don't want to be putting words in his mouth) he wasn't even referring directly to Unique non-clustered indexes. He was instead suggesting you just include them in the index key columns.
 
3:40 PM
you are too kind, I'm sure you parser was not to blame :)
 
@JackDouglas Oh it was. It is sadly lacking a non-SQL-Server context module.
 
@Kermit you were there can you confirm?
 
@Zane He started the whole conversation earlier. He wasn't completely sure IIRC.
 
I see.
 
@Zane If Brent said INCLUDE was bad and to just put everything in the key columns instead, that would be unfortunate. And wrong.
I doubt he would intend that though. The unfortunate part would be if some section of the audience came away with that impression.
 
3:44 PM
No no. I'm not saying he suggested they were bad.
My communication skills seem to be lacking this morning.
 
@PaulWhite - just curios, why the leave-open vote on this question - it appears to be a classic case of "unclear what you're asking"
 
@MaxVernon Because GIVE IT A TRY!!!!
 
@PaulWhite LOL
I didn't see that he'd given an answer
 
Seriously, it's marginal. I was going to VtC as unclear before I noticed Rolando had already answered it (and therefore, understood it clearly). It's also a non-SQL-Server question, and I give them more leeway due to my knowledge and parsing limitations.
I down-voted the question though. It is quite poorly done.
 
@PaulWhite sure, I'm tending to lean towards that lately too. However, there is almost no actual question in the "question". Pretty hard to see that being useful to any future visitor.
 
3:50 PM
@MaxVernon I agree. You make a good case for VtC too localized :)
 
@Zane you were there?
 
Well this is awkward.
 
Yeah he talked about that in the early morning session.
 
Yeah he did
 
@PaulWhite ?
 
3:53 PM
@MaxVernon @Zane and @Kermit at the same event and she didn't say hello.
Awks.
 
ahh
 
@PaulWhite who's she ?
I'm lost.
 
@Kermit Zane
 
@PaulWhite Lol, @Zane is a dude
3 mins ago, by Paul White
Well this is awkward.
 
Zane Brunette is male?
 
3:55 PM
@PaulWhite hahahahahahahahahahah
yeah
 
WTF
 
@PaulWhite I did not have the opportunity to check his genitalia.
 
HHHHHHHHEEEEEEEEYYYYYYYYYOOOOOOOOOOOOOOOOOOOOOOOOO
 
@PaulWhite But he and I sat next to each other in Brent's session
 
@Kermit So why'd you ask if he-she was there?
 
3:56 PM
@Kermit did he rip a few silent but violents?
 
He was talking about for a covering index if it's being used in predicates often then include it in the Key Columns and how if there is a key look up and the columns are small and frequently used then add them to INCLUDE.
 
Does Brunette not imply female in America?
 
@PaulWhite because @Zane asked if I was there
 
Hope I explained that better.
 
@PaulWhite not when it's a last name
 
3:57 PM
@PaulWhite It implies French...
 
Ah. Really? Ha. Ok then.
Monsieur Brunette it is.
 
Apparently @PaulWhite wasn't here any of the times my picture has been posted.
 
Nope.
 
@Zane he's just sexist
 
@Zane i guess you better do that again
 
3:59 PM
@Zane i guess you better do it every day
 
I'm fine without the image.
 
i'm expecting a dick pic
 
@bluefeet I don't think anyone needs to see my ugly mug again.
 
@Kermit no thanks
 
@Kermit Selfie?
 
3:59 PM
@PaulWhite you forgot the hash tag
 

« first day (1211 days earlier)      last day (3664 days later) »