Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Statistics Needed - When loading data?


Statistics Needed - When loading data?

Author
Message
curious_sqldba
curious_sqldba
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1545 Visits: 3573
I have a bunch of empty tables, i will be disabling all the nc indices and leave clustered index enabled. About 10 milllion records will be loaded into this table, i am thinking of disabling following options related to statistics to improve the performance. Can someone clarify if my thinking is right here or is there better way to do this. All the load is done through bulk inserts.

Disable:

i) Auto create statistics
ii) Auto update statistics
iii) Auto update statistics asynchronously.

I plan to manually update the statistics after the load and have all the three above options left enabled after loading the data
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47427 Visits: 44405
Don't, it'll have no effect on performance. Stats aren't created or updated until needed.

Do an update with fullscan afterwards, but no need to disable any options.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


curious_sqldba
curious_sqldba
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1545 Visits: 3573
GilaMonster (11/11/2013)
Don't, it'll have no effect on performance. Stats aren't created or updated until needed.

Do an update with fullscan afterwards, but no need to disable any options.



My understanding is if the table has stale statistics, with the auto create and auto update stats option enabled it will first create/update the stats before loading the data ( bulk insert). If the options are disabled it will just load the data and not worry about stats?
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47427 Visits: 44405
Nope. Not unless your bulk load is querying the table first. Stats do not get created or updated unless they are needed to generate an execution plan.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


curious_sqldba
curious_sqldba
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1545 Visits: 3573
GilaMonster (11/12/2013)
Nope. Not unless your bulk load is querying the table first. Stats do not get created or updated unless they are needed to generate an execution plan.


So bulk inserts don't need a execution plan? i thought every query needs it


We are selecting from source and bulk-inserting to this table. Should we disable those options on source?
Keith Tate
Keith Tate
SSChasing Mays
SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)

Group: General Forum Members
Points: 620 Visits: 979
Here is a great post by Erin Stellato that talks about when/how stats get updated. http://www.sqlskills.com/blogs/erin/understanding-when-statistics-will-automatically-update/
If covers what you are trying to do and why you should worry about turning off those options (like Gail said).



Microsoft Certified Master - SQL Server 2008
Follow me on twitter: @keith_tate

Forum Etiquette: How to post data/code on a forum to get the best help
Keith Tate
Keith Tate
SSChasing Mays
SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)SSChasing Mays (620 reputation)

Group: General Forum Members
Points: 620 Visits: 979
curious_sqldba (11/12/2013)
GilaMonster (11/12/2013)
Nope. Not unless your bulk load is querying the table first. Stats do not get created or updated unless they are needed to generate an execution plan.


So bulk inserts don't need a execution plan? i thought every query needs it


We are selecting from source and bulk-inserting to this table. Should we disable those options on source?

You are selecting from the source before the bulk insert, is there a concern that the stats will be out of date before the bulk insert? If not, then you shouldn't have to worry about turning those options off.



Microsoft Certified Master - SQL Server 2008
Follow me on twitter: @keith_tate

Forum Etiquette: How to post data/code on a forum to get the best help
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47427 Visits: 44405
curious_sqldba (11/12/2013)
GilaMonster (11/12/2013)
Nope. Not unless your bulk load is querying the table first. Stats do not get created or updated unless they are needed to generate an execution plan.


So bulk inserts don't need a execution plan? i thought every query needs it


Sure it needs an execution plan, I didn't say they don't use a plan. What I said was 'unless [the stats] are needed to generate a plan'. Statistics are needed when the row distribution of the existing data in the table affects the choice of execution plan. Insert plans don't change based on the data that's already in the table.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search