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
»
SQL Server 2008
»
SQL Server 2008 Administration
»
Adding new data file to tempdb, leads to data...
Adding new data file to tempdb, leads to data incorrection
Rate Topic
Display Mode
Topic Options
Author
Message
Bhuvnesh
Bhuvnesh
Posted Wednesday, December 19, 2012 11:08 PM
SSCrazy
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
In one of the tempdb blog
Here is link
, it is stated that sometimes when we add a new file to tempdb to improve the performane it might lead to data incorrection (in context of data sorting or order) what i was thinking here is it could happen where multiple CPUs (multiple threads) are handling that particuler query (parallelism ) and combine the result at the end (not in order). am i on thr right page ?
-------Bhuvnesh----------
While 1 = 1 (Learning SQL....)
Click to get fast response of your post
Post #1398782
GilaMonster
GilaMonster
Posted Thursday, December 20, 2012 3:28 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 4:11 PM
Points: 37,741,
Visits: 30,020
Depends what you mean by 'not in order'
Neither parallelism, nor multiple tempDB files are going to result in a query with an order by returning data out of order. Any time there's a query without an order by, no order is ever guaranteed and hence no order should ever be assumed, no matter what the server setup is.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #1398885
Bhuvnesh
Bhuvnesh
Posted Thursday, December 20, 2012 4:26 AM
SSCrazy
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
OK thanks for explanation . can you please explain the phrase
We Added a Tempdb Data File, and Data Was Wrong
from
http://www.brentozar.com/archive/2011/08/tempdb-multiplefiles-sort/
-------Bhuvnesh----------
While 1 = 1 (Learning SQL....)
Click to get fast response of your post
Post #1398905
Gazareth
Gazareth
Posted Thursday, December 20, 2012 5:48 AM
UDP Broadcaster
Group: General Forum Members
Last Login: Monday, May 20, 2013 1:53 AM
Points: 1,474,
Visits: 2,342
The data wasn't wrong, what's wrong is the assumption that the data would be ordered when no order was specified.
That whole blog post could be rewritten into a fairly good demonstration of why assuming an order when an order by is not used is false. Setting it up as multiple temp db files causes a problem is pretty misleading IMO.
"a high severity production incident was caused by adding an additional data file to the tempdb database." -> "adding an additional data file to the tempdb database caused a false assumption in the application to become evident when it caused a high severity production incident."
That's more like it
Post #1398929
GilaMonster
GilaMonster
Posted Thursday, December 20, 2012 7:09 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 4:11 PM
Points: 37,741,
Visits: 30,020
Bhuvnesh (12/20/2012)
OK thanks for explanation . can you please explain the phrase
We Added a Tempdb Data File, and Data Was Wrong
from
http://www.brentozar.com/archive/2011/08/tempdb-multiplefiles-sort/
Why don't you read the blog post? It was explained in there.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #1398957
Michael Valentine Jones
Michael Valentine Jones
Posted Thursday, December 20, 2012 7:35 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 10:43 AM
Points: 2,945,
Visits: 10,517
The order of the data could have changed without adding a file to tempdb, so that problem could have started happening anytime.
You should always have an ORDER BY unless you are absolutely sure that the order does not matter.
It's very common to assume that because you see the data from a query returned in the order you wanted that it will continue to be returned in that order in the future.
It's a common wrong assumption that when you select from a table the data will be returned in the order of the clustered index.
Post #1398973
Jeff Moden
Jeff Moden
Posted Thursday, December 20, 2012 5:00 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 4:51 PM
Points: 32,923,
Visits: 26,811
Kendra's example was purely to show unintended consequences of making seemingly harmless changes to databases. Despite appearances, there is absolutely nothing that she's done that demonstrates that having multiple temp files affects the order in which data is imported. She did, however, do a great job demonstrating an accident just waiting to happen.
To wit, the REAL problem with the code (which she hasn't explained because that wasn't the objective of the article) is the addition of an IDENTITY column after the table is populated. The order of the IDENTITY values that will appear in such an "after the fact" manner is absolutely NOT guaranteed to be in what people think is the correct order according to the data present.
And, YES!!! I have the proof in the form of code! I'm in the process of writing it up.
Another set of unintended lessons that I believe you need to learn from her fine post is to expect the unexpected, knowing more about T-SQL before you decide "good enough" really is, and taking the time to make your code as bullet proof as possible.
--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 #1399134
Bhuvnesh
Bhuvnesh
Posted Thursday, December 20, 2012 10:49 PM
SSCrazy
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
I had read the article but couldnt able to extract the pure juice thats why i added a post here to have more and clear insight.
Jeff Moden (12/20/2012)
I believe you need to learn from her fine post is to expect the unexpected, knowing more about T-SQL before you decide "good enough" really is, and taking the time to make your code as bullet proof as possible.
thanks jeff.. i loved the quote you used here
"Expect the unexpected".
-------Bhuvnesh----------
While 1 = 1 (Learning SQL....)
Click to get fast response of your post
Post #1399191
« Prev Topic
|
Next Topic »
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.