Answered by:
User defined statistics

Question
-
Hi there!!
I have a table which has just one row say for current date. this row is daily updated with current date. Now my all the SPs some 1000 uses this table to extract current date.
Now i want to know how beneficial would it be if i create a statistic on this table with the current date column something like stats on (DateKey, Date)
Structure of d table: CREATE TABLE TblDate ( DateKey NOT NULL, DATE DATETIME );
thanks!!
Rahul Kumar, MCTS, India, http://sqlserversolutions.blogspot.com/Tuesday, April 27, 2010 6:30 AM
Answers
-
There will not be any gain as you sais this table contains only one row.
The goal for using statistics in SQL Server is to allow the optimizer to get good cardinality estimates so it can find good query plans.
Consider creating statistics with the CREATE STATISTICS statement when any of the following applies:
- The Database Engine Tuning Advisor suggests creating statistics.
- The query predicate contains multiple correlated columns that are not already in the same index.
- The query selects from a subset of data.
- The query has missing statistics.
Please refer Determining When to Create Statistics
Sivaprasad S http://sivasql.blogspot.com Please click the Mark as Answer button if a post solves your problem!- Proposed as answer by SIVAPRASAD S - SIVA Tuesday, April 27, 2010 7:21 AM
- Marked as answer by Rahul Sherawat Wednesday, April 28, 2010 8:52 AM
Tuesday, April 27, 2010 7:21 AM
All replies
-
There will not be any gain as you sais this table contains only one row.
The goal for using statistics in SQL Server is to allow the optimizer to get good cardinality estimates so it can find good query plans.
Consider creating statistics with the CREATE STATISTICS statement when any of the following applies:
- The Database Engine Tuning Advisor suggests creating statistics.
- The query predicate contains multiple correlated columns that are not already in the same index.
- The query selects from a subset of data.
- The query has missing statistics.
Please refer Determining When to Create Statistics
Sivaprasad S http://sivasql.blogspot.com Please click the Mark as Answer button if a post solves your problem!- Proposed as answer by SIVAPRASAD S - SIVA Tuesday, April 27, 2010 7:21 AM
- Marked as answer by Rahul Sherawat Wednesday, April 28, 2010 8:52 AM
Tuesday, April 27, 2010 7:21 AM -
Rahul,
As u mentioned that table has only one row , so there will not any proformance gain on creating a statistics or indexes.
Mohd Sufian www.sqlship.wordpress.com Please mark the post as Answered if it helped.Tuesday, April 27, 2010 9:31 AM -
Since you said there will be one row there wont be any performane gain by adding a keyTuesday, April 27, 2010 2:35 PM