|
sql
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Autostatistic ON/OFF on separate tables?
Hi
Is't possible to set Auto updatestatistic ON and OFF on separates tables or is't only on database level? Regards GG GG,
AUTO_UPDATE_STATISTICS is a database setting, so you cannot set it per table. If you want that fine a control, you could turn it off. ALTER DATABASE xxx SET AUTO_UPDATE_STATISTICS OFF; Then you can run UPDATE STATISTICS on the tables and views that you wish to update. RLF Show quoteHide quote "GG" <g*@newsgroup.com> wrote in message news:uAE7Gsk%23JHA.4432@TK2MSFTNGP05.phx.gbl... > Hi > > Is't possible to set Auto updatestatistic ON and OFF on separates tables > or is't only on database level? > Regards > GG You can have it on at the database level and turn it off for selected
tables (UPDATE STATISTICS ... WITH NORECOMPUTE), sp_autostats etc. -- Show quoteHide quoteTibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://sqlblog.com/blogs/tibor_karaszi "GG" <g*@newsgroup.com> wrote in message news:uAE7Gsk%23JHA.4432@TK2MSFTNGP05.phx.gbl... > Hi > > Is't possible to set Auto updatestatistic ON and OFF on separates > tables or is't only on database level? > Regards > GG Thanks for your answer.
What I'm thinking of is that we have an database 300Gb and two of these tables has about 60 milj records each. To day the Autostat is turned off and a job is executing every night but these two tables takes extremly long time. So my thought is that turn on autostat for all except the two biggest and only do update stat with the night job Regards GG Show quoteHide quote "Tibor Karaszi" <tibor_please.no.email_kara***@hotmail.nomail.com> wrote in message news:u9YR3am%23JHA.1336@TK2MSFTNGP05.phx.gbl... > You can have it on at the database level and turn it off for selected > tables (UPDATE STATISTICS ... WITH NORECOMPUTE), sp_autostats etc. > > -- > Tibor Karaszi, SQL Server MVP > http://www.karaszi.com/sqlserver/default.asp > http://sqlblog.com/blogs/tibor_karaszi > > > "GG" <g*@newsgroup.com> wrote in message > news:uAE7Gsk%23JHA.4432@TK2MSFTNGP05.phx.gbl... >> Hi >> >> Is't possible to set Auto updatestatistic ON and OFF on separates tables >> or is't only on database level? >> Regards >> GG > That is exactly what SQL Server let you achieve. Turn on autostats for
the database and turn it off for those two tables. -- Show quoteHide quoteTibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://sqlblog.com/blogs/tibor_karaszi "GG" <g*@newsgroup.com> wrote in message news:Omt2zBv%23JHA.4560@TK2MSFTNGP03.phx.gbl... > Thanks for your answer. > > What I'm thinking of is that we have an database 300Gb and two of > these tables has about 60 milj records each. > To day the Autostat is turned off and a job is executing every night > but these two tables takes extremly long time. > > So my thought is that turn on autostat for all except the two > biggest and only do update stat with the night job > > Regards > GG > > > "Tibor Karaszi" <tibor_please.no.email_kara***@hotmail.nomail.com> > wrote in message news:u9YR3am%23JHA.1336@TK2MSFTNGP05.phx.gbl... >> You can have it on at the database level and turn it off for >> selected tables (UPDATE STATISTICS ... WITH NORECOMPUTE), >> sp_autostats etc. >> >> -- >> Tibor Karaszi, SQL Server MVP >> http://www.karaszi.com/sqlserver/default.asp >> http://sqlblog.com/blogs/tibor_karaszi >> >> >> "GG" <g*@newsgroup.com> wrote in message >> news:uAE7Gsk%23JHA.4432@TK2MSFTNGP05.phx.gbl... >>> Hi >>> >>> Is't possible to set Auto updatestatistic ON and OFF on separates >>> tables or is't only on database level? >>> Regards >>> GG >> > GG (g*@newsgroup.com) writes:
> What I'm thinking of is that we have an database 300Gb and two of these Does in run UPDATE STATISTICS WITH FULLSCAN? If you change it to> tables has about 60 milj records each. > To day the Autostat is turned off and a job is executing every night but > these two tables takes extremly long time. UPDATE STATISTICS WITH FULLSCAN, INDEX things go faster. Then again, if you rebuild indexes, there is no reason to update index statistics as well. > So my thought is that turn on autostat for all except the two biggest and That is achievable, but whether it is the right action, I am less sure.> only do update stat with the night job Autostats sets in on a table when 500 rows have been added, and then when 20% of the rows have been modified. (This is a somewhat loose description.) This means that autostats do not set in very often on these tables. In the system I work with, I've contemplating turning off autostats on tables with a fairly low number of rows, but where rows get added and deleted all the time, causing autostats to set in often with little use, but causing recompiles. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx Thank's for your tips Erland, I will look over this alternetiv
Regards GG Show quoteHide quote "Erland Sommarskog" <esq***@sommarskog.se> wrote in message news:Xns9C3D21BB3CF8Yazorman@127.0.0.1... > GG (g*@newsgroup.com) writes: >> What I'm thinking of is that we have an database 300Gb and two of these >> tables has about 60 milj records each. >> To day the Autostat is turned off and a job is executing every night but >> these two tables takes extremly long time. > > Does in run UPDATE STATISTICS WITH FULLSCAN? If you change it to > UPDATE STATISTICS WITH FULLSCAN, INDEX things go faster. Then again, > if you rebuild indexes, there is no reason to update index statistics > as well. > >> So my thought is that turn on autostat for all except the two biggest and >> only do update stat with the night job > > That is achievable, but whether it is the right action, I am less sure. > Autostats sets in on a table when 500 rows have been added, and then when > 20% of the rows have been modified. (This is a somewhat loose > description.) > This means that autostats do not set in very often on these tables. > > In the system I work with, I've contemplating turning off autostats on > tables with a fairly low number of rows, but where rows get added and > deleted all the time, causing autostats to set in often with little > use, but causing recompiles. > > -- > Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se > > Links for SQL Server Books Online: > SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx > SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx > SQL 2000: > http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx > GG (g*@newsgroup.com) writes:
> Is't possible to set Auto updatestatistic ON and OFF on separates tables Yes, look at sp_autostats in Books Online.> or is't only on database level? -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Other interesting topics
How to Enqueue Messages With Service Broker in a Timely Fashion
Create Database on the server Upgrading from SQL Express to SQL Enterprise Raid levels Maintenance did not delete old files sql server management studio to connect to database Install SQL Server 2008 Questions .... sql replication SQL Server Programming Books Rolling back bcp takes forever. Shouldn't. |
|||||||||||||||||||||||