Solved

Can I consolidate missing indexes recommendations from SQL 2008

Posted on 2011-03-17
2
429 Views
Last Modified: 2012-05-11
I'm getting some timeout errors and SQL Server suggested several missing indexes. Here's the table definiton for the columns mentioned in the missing indexes. I've left off all other columns (a few dozen).
CREATE TABLE [dbo].[MyTable](
	[RowID] [int] IDENTITY(1,1) NOT NULL,
	[Deleted] [bit] NOT NULL,
	[Requested] [datetime] NULL,
	[Received] [datetime] NULL,
	[OtherID] [int] NULL,
	[UserID] [int] NULL,
 CONSTRAINT [PK_MyTable] PRIMARY KEY CLUSTERED 
(
	[RowID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[MyTable] ADD  CONSTRAINT [DF_MyTable_Deleted]  DEFAULT ((0)) FOR [Deleted]
GO

Open in new window

SQL 2008 suggested the following missing indexes which overlap somewhat. The first one is probably for the query with the biggest impact.

-- Suggested MyTable Missing Indexes:
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[MyTable] ([Deleted],[Requested])
INCLUDE ([RowID],[OtherID],[UserID],[Received])
GO

CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[MyTable] ([Deleted],[Requested])
INCLUDE ([RowID],[OtherID],[UserID])
GO

CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[MyTable] ([OtherID])
GO

CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[MyTable] ([OtherID],[Deleted])
GO

Open in new window


Which of the suggested indexes are redundant or which ones can I combine (and if so, how)?

Thanks in advance.
0
Comment
Question by:ZekeLA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 500 total points
ID: 35160472
on the face of it these 2 indexes would probably suffice

to cover all the range of instances encountered...

however i'm not clear on how useful the deleted column will be indexed
since its a bit column and they don't (only 3 possible values null 0,1) make good
index sources...

is deleted only 1 for a very small proportion of the rows? (in which case it may become useful in some circumstances...) but probably shouldn't be included in the last index...
-- Suggested MyTable Missing Indexes:
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[MyTable] ([Deleted],[Requested])
INCLUDE ([RowID],[OtherID],[UserID],[Received])
GO


CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[MyTable] ([OtherID],[Deleted])
GO

Open in new window

0
 
LVL 1

Author Comment

by:ZekeLA
ID: 35160847
Yes, Deleted is only used for a small number of samples. I tried out the first index and only gained about 10% or so. I suspect missing indexes is not the approach to this problem. I think I'll need to restructure some views since there's too much logic occurring on the fly.

But you get the points anyway. Thanks.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 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