Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Objects are without statistics!!! Expand / Collapse
Author
Message
Posted Thursday, January 21, 2010 11:06 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 7:07 PM
Points: 186, Visits: 812
Hello,

We've got a client that detect that in one database three tables are without statistics.

Q1: My SQL Instance its configured to automatically update statistics so why are not update statistics on those objects?

Q2: How can the client detect that statistics were not updated?

Q3: What is the best way to configure or not configure statistics in an object?

Q4: Whar is the impact on create statistics during daily working hours?

Table [TableName1] on column [column1]
Table [TableName2] on column [column2]
Table [TableName3] on column [column3]

Thanks and regards,
JMSM :)
Post #851444
Posted Thursday, January 21, 2010 11:27 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 4:03 PM
Points: 42,485, Visits: 35,554
JMSM (1/21/2010)

We've got a client that detect that in one database three tables are without statistics.

Q1: My SQL Instance its configured to automatically update statistics so why are not update statistics on those objects?


Auto_update only updates existing statistics, it won't create new ones. For that, auto_create has statistics to be enabled and SQL has to need the statistics. If it doesn't need them, it won't create them.

Q3: What is the best way to configure or not configure statistics in an object?


Let SQL create them (auto create), let SQL automatically update them unless you know that the auto_update is not sufficient.

Q4: Whar is the impact on create statistics during daily working hours?

Table [TableName1] on column [column1]
Table [TableName2] on column [column2]
Table [TableName3] on column [column3]


Minimal, but only create them if you're sure they're needed. If auto_create statistics is on, SQL will automatically create any it needs and you don't have to bother.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
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

Post #851459
Posted Thursday, January 21, 2010 12:04 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 4:50 PM
Points: 5,574, Visits: 24,823
In additiion to GilaMonster's comments, and the database is configured as decribed.
Do the two tables in question have any indexes? If so statistics will be automatically created for them. If auto created statistics exist their name will start with "_WA_"

If you desire to check the auto_create and auto_update statistics setting execute:
SELECT is_auto_create_stats_on,  is_auto_update_stats_on
FROM sys.databases WHERE Name = 'xx''--replace the xx with the name of the database
If these are set to ON then a value of 1 will be returned for each item

Does your user have SSMS?
If yes then have them select each table and then select statistics -- if stats exist their names will be shown.
To learn when the stats have been last updated double click on the statistics name, then in the drop down double click on "Properties" , in the next window select "Details" (single click) - this will display the last time the stats were updated and further information - a lot of information.

SQL in general attempts to create statistics even for the simpliest of tables and queries. For example:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[NonExisting](
[ABC] [varchar](10) NULL
) ON [PRIMARY]
GO
INSERT INTO dbo.NonExisting
SELECT 'BBB' UNION ALL
SELECT 'ouch' UNION ALL
SELECT 'mymy'
-- now execute
SELECT ABC FROM dbo.NonExisting

Check and you will see that a statistic was created on my machine it was named "-WA_sys-00000001_18EBB532"


If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #851493
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse