I am reading the Microsoft article 'Statistical maintenance
functionality (autostats) in SQL Server'
(http://support.microsoft.com/kb/q195565/) and I'm wondering about this
part:
"NOTE: In addition to cardinality, the selectivity of the predicate
also affects AutoStats generation. This means that statistics may not
be updated afer every 500 modifications if cardinality were < 500 or
for every 20% of changes if cardinality were > 500. A scale up factor
(value ranges from 1 to 4, 1 and 4 inclusive) is generated depending on
the selectivity and a product of this factor and the number of changes
as obtained from the algorithm would be the actual number of
modifications required for AutoStats generation."
Does anyone know if a high selectivity means the factor is 1 or 4? Does
anyone know more about how that value is determined?
I'm also wondering about this part of the same article:
"Consider a second table, t2, that has a cardinality of 1,000. For
tables with greater than 500 rows, SQL Server will UPDATE STATISTICS
when (500 + 20 percent) changes have been made. Doing the math, 20
percent of 1,000 is 200, so you can expect to see AutoStat start after
approximately 700 modifications have been made to the table."
I don't understand why they say that AutoStats will execute after 700
modifications. 20 percent of 1000 rows is 200 rows, so wouldn't we
expect to see AutoStats after 200 rows, not 700 rows?
Thanks> Does anyone know if a high selectivity means the factor is 1 or 4? Does
> anyone know more about how that value is determined?
Does it really matter which is which? To the best of my knowledge you can't
see it anyway unless you decode the statblob. The point is that if the
selectivity is low you can get by with more rows changing before you have to
update the stats.
> I don't understand why they say that AutoStats will execute after 700
> modifications. 20 percent of 1000 rows is 200 rows, so wouldn't we
> expect to see AutoStats after 200 rows, not 700 rows?
It says 500 + 20%. If 20% is 200 rows then if you add that to 500 you get
700. Make sense?
If you are using sql 2005 these figures have chaged somewhat and you want to
ensure you are using the correct whitepaper.
--
Andrew J. Kelly SQL MVP
<pshroads@.gmail.com> wrote in message
news:1156534531.968254.118570@.75g2000cwc.googlegroups.com...
>I am reading the Microsoft article 'Statistical maintenance
> functionality (autostats) in SQL Server'
> (http://support.microsoft.com/kb/q195565/) and I'm wondering about this
> part:
> "NOTE: In addition to cardinality, the selectivity of the predicate
> also affects AutoStats generation. This means that statistics may not
> be updated afer every 500 modifications if cardinality were < 500 or
> for every 20% of changes if cardinality were > 500. A scale up factor
> (value ranges from 1 to 4, 1 and 4 inclusive) is generated depending on
> the selectivity and a product of this factor and the number of changes
> as obtained from the algorithm would be the actual number of
> modifications required for AutoStats generation."
> Does anyone know if a high selectivity means the factor is 1 or 4? Does
> anyone know more about how that value is determined?
> I'm also wondering about this part of the same article:
> "Consider a second table, t2, that has a cardinality of 1,000. For
> tables with greater than 500 rows, SQL Server will UPDATE STATISTICS
> when (500 + 20 percent) changes have been made. Doing the math, 20
> percent of 1,000 is 200, so you can expect to see AutoStat start after
> approximately 700 modifications have been made to the table."
> I don't understand why they say that AutoStats will execute after 700
> modifications. 20 percent of 1000 rows is 200 rows, so wouldn't we
> expect to see AutoStats after 200 rows, not 700 rows?
> Thanks
>
Tuesday, March 20, 2012
Question about how SQL Server decides when to auto-update statistics
Labels:
article,
auto-update,
autostats,
database,
decides,
functionality,
maintenance,
microsoft,
mysql,
oracle,
reading,
server,
sql,
statistical,
statistics
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment