August 1, 2012 at 5:40 am
Hi All,
I created some statistics on a table on column. But when i examine statistics detail, it is not created and updated.
"No statistics is available" message is seen.
The other problem is,
Automatically created statistics was not updated regularly. Although the table is update everyday, last statistics date is last month. Is there a reson for this message?
My DB belong to a BI Application.
Regards,
August 1, 2012 at 5:57 am
Even though 'Auto Create Statistics' is ON, You need to run a query to 'acutally' enabled.Optimizer will not create a statistics until any query fire against the table.
August 1, 2012 at 6:01 am
"Automatically created statistics was not updated regularly. Although the table is update everyday, last statistics date is last month. Is there a reson for this message?"
1. Have you enabled 'auto update stats'= ON?
2. how many rows are there in that table ? How many updates are running against the table.?
Optimizer will employ some algorithm to update the statistics..
August 1, 2012 at 6:03 am
Can you post a small script that reproduces the problem (e.g. create table, insert test data, create the statistics and then the statistics are not created)?
About the statistics that did not get updated - Don't forget that the statistics are marked as should be updated after 500 rows + 20% of the number of rows in the table were modified. If number of rows that were inserted/deleted/updated t did not reach this number, then the statistics should not be updated.
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
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/
August 1, 2012 at 6:21 am
Sure,
USE [STATS_DB]
GO
Select DATABASEPROPERTY('stats_db', 'IsAutoCreateStatistics')
GO
Create Table Stats_Table ( a Int)
GO
select OBJECT_NAME (OBJECT_ID) ObjectName, * from sys.stats where [OBJECT_ID] = OBJECT_ID('Stats_Table')
If @@ROWCOUNT = 0
Print 'No Stats Available'
Else
Print 'Stats Available'
GO
Select * From [STATS_DB]..Stats_Table where a like 'a%'
GO
select OBJECT_NAME (OBJECT_ID) ObjectName, * from sys.stats where [OBJECT_ID] = OBJECT_ID('Stats_Table')
If @@ROWCOUNT = 0
Print 'No Stats Available'
Else
Print 'Stats Available'
GO
August 1, 2012 at 6:25 am
sorry for spamming... I misread he created stats.... need to check.
August 1, 2012 at 6:28 am
I ran the script and after the select statement, the statistics were created. Are you sure that the statistics were not created on your server?
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
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/
August 1, 2012 at 6:37 am
Yes, But i tested it in Express edition. Any limitation?
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply