Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by Stephen Tirone
»
Caution with EXCEPT
30 posts, Page 2 of 3
««
1
2
3
»»
Caution with EXCEPT
Rate Topic
Display Mode
Topic Options
Author
Message
jdurandt
jdurandt
Posted Monday, January 18, 2010 8:20 AM
Valued Member
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 12:40 PM
Points: 54,
Visits: 145
That's interesting
I benchmarked EXCEPT vs WHERE NOT IN (SELECT .....), and for my dataset, server, DB version etc. the performance results were equivalent, or biased towards EXCEPT.
Can you give more details about your scenario?
Post #849195
jdurandt
jdurandt
Posted Monday, January 18, 2010 8:22 AM
Valued Member
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 12:40 PM
Points: 54,
Visits: 145
I find that an easier way to get the list of columns is to drag them from the object explorer in SSMS. If you expand the table object's columns list, you can then drag the "Columns" parent entry into a query window, to get the comma seperated list of columns.
This works for some other items too.
Post #849196
Mike DiRenzo
Mike DiRenzo
Posted Monday, January 18, 2010 8:34 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 12:11 PM
Points: 143,
Visits: 183
Bravo! What a great catch. You have my 5 star vote.
-Mike
Post #849209
Jeff Moden
Jeff Moden
Posted Monday, January 18, 2010 9:53 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Yesterday @ 9:57 PM
Points: 32,893,
Visits: 26,771
jdurandt (1/18/2010)
That's interesting
I benchmarked EXCEPT vs WHERE NOT IN (SELECT .....), and for my dataset, server, DB version etc. the performance results were equivalent, or biased towards EXCEPT.
Can you give more details about your scenario?
Can you post your benchmark code, please?
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #849264
Jeff Moden
Jeff Moden
Posted Monday, January 18, 2010 9:56 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Yesterday @ 9:57 PM
Points: 32,893,
Visits: 26,771
Nicely done, Stephen. Well written and straight to the point.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #849268
ChrisM@Work
ChrisM@Work
Posted Monday, January 18, 2010 10:17 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 3:10 AM
Points: 5,602,
Visits: 10,953
Some articles are well worth reading twice.
I've spent all afternoon working for the first time with EXCEPT instead of the usual LEFT JOIN and checking for NULL, and it's taken half the keystrokes with no noticeable performance cost. Thanks!
“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.”
- Gail Shaw
For fast, accurate and documented assistance in answering your questions, please read
this article
.
Understanding and using APPLY, (I)
and
(II)
Paul White
Hidden RBAR: Triangular Joins
/
The "Numbers" or "Tally" Table: What it is and how it replaces a loop
Jeff Moden
Exploring Recursive CTEs by Example
Dwain Camps
Post #849275
Joseph M. Steinbrunner
Joseph M. Steinbrunner
Posted Monday, January 18, 2010 12:25 PM
SSC Rookie
Group: General Forum Members
Last Login: Wednesday, February 20, 2013 11:47 AM
Points: 30,
Visits: 80
Good explanation. I saw what was coming on your first SQL example right away (as some others did) when the use of "SELECT *" was there.
Post #849326
shannonjk
shannonjk
Posted Monday, January 18, 2010 12:48 PM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 1:33 PM
Points: 578,
Visits: 778
Good article Stephen I am going to write the points down of this article in some notes I am gathering.
I wish that they would design the inverse of the INTERSECT operator. As it will show you all the rows matching from both sides of the statement. If they had a NOT INTERSECT it seems like it would return the results of all the aforementioned UNION queries.
Link to my blog
http://notyelf.com/
Post #849343
gchornenkyy
gchornenkyy
Posted Monday, January 18, 2010 12:56 PM
Old Hand
Group: General Forum Members
Last Login: Thursday, February 14, 2013 2:39 PM
Points: 311,
Visits: 277
For bugmenot-573553:
Try do develop correct indexes - it may help
Post #849346
shannonjk
shannonjk
Posted Monday, January 18, 2010 2:20 PM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 1:33 PM
Points: 578,
Visits: 778
Stephen,
Again a great article, but if I could throw in one little tiny technicality to this I would feel much better
While I realize the emphasis of your article was against 2 tables, and therefore you wrote it as such, I would like to point out that the left and right side of EXCEPT, INTERSECT, and UNION Operators is the comparison of 'query results' and not 'tables'. Though a seemingly minor point, I felt necessary to point it out
Link to my blog
http://notyelf.com/
Post #849401
« Prev Topic
|
Next Topic »
30 posts, Page 2 of 3
««
1
2
3
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.