Solved

_WA_SYS statistics created - should you index on these as well

Posted on 2006-10-26
2
1,551 Views
Last Modified: 2008-01-09
We have a number of WA_SYS statistics created (auto on) against tables. Is it wise to create indexes for these fields listed in the WA_SYS if you dont have them setup already. This is a DSS environment.

Thnaks

Paul
0
Comment
Question by:Paul_Blackler
2 Comments
 
LVL 21

Assisted Solution

by:Kevin3NF
Kevin3NF earned 200 total points
ID: 17814211
I wouldn't blindly go create an index just because the system did it.  I would rather do some investigating and (SQL) profiling to see where my perf can be improved and create indexes there if necessary.
0
 
LVL 10

Accepted Solution

by:
AaronAbend earned 300 total points
ID: 17814602
Be careful - statistics are used by the optimizer to choose the path for the query - they are not actually used to execute the query itself.  

A lot of small, low cardinality columns will be scanned by the optimizer and stats will be created. You do not want indexes on these columns because their low cardinality (low number of values) means an index will not help much (imagine a table of states that also includes the country but there is only one value for country - indexing country does not help your query performance).

Check the strategies and base your indexes on what the strategies are doing. If you see time consuming tablescans, definitely create indexes to prevent that from happening.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now