Home All Groups Group Topic Archive Search About

Autostatistic ON/OFF on separate tables?

Author
1 Jul 2009 12:53 PM
GG
Hi

Is't possible to set Auto updatestatistic ON and OFF on separates tables or
is't only on database level?
Regards
GG

Author
1 Jul 2009 1:12 PM
Russell Fields
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
Are all your drivers up to date? click for free checkup

Author
1 Jul 2009 4:12 PM
Tibor Karaszi
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 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
Author
2 Jul 2009 8:38 AM
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
>
Author
2 Jul 2009 3:58 PM
Tibor Karaszi
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 quote
"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
>>
>
Author
2 Jul 2009 10:12 PM
Erland Sommarskog
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
Author
3 Jul 2009 6:37 AM
GG
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
>
Author
1 Jul 2009 10:35 PM
Erland Sommarskog
GG (g*@newsgroup.com) writes:
> Is't possible to set Auto updatestatistic ON and OFF on separates tables
> or is't only on database level?

Yes, look at sp_autostats in Books Online.


--
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

Bookmark and Share