Will creating index help in this case

Posted by The King on Stack Overflow See other posts from Stack Overflow or by The King
Published on 2010-05-11T13:09:20Z Indexed on 2010/05/11 13:14 UTC
Read the original article Hit count: 183

I'm still a learning user of SQL-SERVER2005.

Here is my table structure

CREATE TABLE [dbo].[Trn_PostingGroups](
[ControlGroup] [char](5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[PracticeCode] [char](5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ScanDate] [smalldatetime] NULL,
[DepositDate] [smalldatetime] NULL,
[NameOfFile] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DepositValue] [decimal](11, 2) NULL,
[RecordStatus] [char](1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_Trn_PostingGroups_1] PRIMARY KEY CLUSTERED 
(
    [ControlGroup] ASC,
    [PracticeCode] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

Scenario 1 : Suppose I have a query like this...

Select * from Trn_PostingGroups where PracticeCode = 'ABC'

Will indexing on Practice Code seperately help me in making my query faster??

Scenario 2 :

Select * from Trn_PostingGroups 
where 
    ControlGroup = 12701 
    and PracticeCode = 'ABC'
    and NameOfFile = 'FileName1'

Will indexing on NameOfFile seperately help me in making my query faster ??

© Stack Overflow or respective owner

Related posts about sql-server-2005

Related posts about performance-tuning