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

Missing Indexes Expand / Collapse
Author
Message
Posted Wednesday, October 10, 2012 9:57 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 12:01 PM
Points: 299, Visits: 1,115
Hi everyone,

I ran the missing indexes DMV and I'm trying to figure out what indexes need to be applied based on the results.

ObjecttName Equality_Columns Inequality_Columns
[dbo].[APP_DEAL] [OFFR_TYPE_CD] [CRETD_DT]
[dbo].[APP_DEAL] [OFFR_TYPE_CD]
[dbo].[APP_DEAL] [LKUP_ID], [ATTR_VAL]


I understand that I still need to do a lot of digging into this before I go ahead and create indexes based on the results of this DMV but as a starting point I'd like to create these indexes on a dev box and see if this improves the performance.

So, can I create separate NC indexes on OFFR_TYPE_CD and CRETD_DT columns also can I create a composite index on [LKUP_ID] and [ATTR_VAL] columns?
Post #1371022
Posted Wednesday, October 10, 2012 11:29 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 2:53 AM
Points: 1,101, Visits: 5,290
sunny.tjk (10/10/2012)
So, can I create separate NC indexes on OFFR_TYPE_CD and CRETD_DT columns

No. Single composite index is better.

also can I create a composite index on [LKUP_ID] and [ATTR_VAL] columns?

Yes.
Post #1371216
Posted Thursday, October 11, 2012 6:29 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 12:01 PM
Points: 299, Visits: 1,115
Suresh B. (10/10/2012)
sunny.tjk (10/10/2012)
So, can I create separate NC indexes on OFFR_TYPE_CD and CRETD_DT columns

No. Single composite index is better.

also can I create a composite index on [LKUP_ID] and [ATTR_VAL] columns?

Yes.


If i create a single composite index on [LKUP_ID] and [ATTR_VAL] columns, will the index be useful if I run a query like this:
SELECT LKUP_ID, ATTR_VAL
FROM [APP_DEAL]
WHERE ATTR_VAL=97067
My question is, will the index be useful only if I use both LKUP_ID and ATTR_VAL in the WHERE clause or can I use either one of these columns in the WHERE clause.
Post #1371413
Posted Thursday, October 11, 2012 8:57 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 12:01 PM
Points: 299, Visits: 1,115
Any suggestions, please?
Post #1371869
Posted Thursday, October 11, 2012 9:15 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Yesterday @ 9:19 PM
Points: 596, Visits: 2,932
If i create a single composite index on [LKUP_ID] and [ATTR_VAL] columns, will the index be useful if I run a query like this:
SELECT LKUP_ID, ATTR_VAL
FROM [APP_DEAL]
WHERE ATTR_VAL=97067
My question is, will the index be useful only if I use both LKUP_ID and ATTR_VAL in the WHERE clause or can I use either one of these columns in the WHERE clause.[/quote]

The index will be ued if you filter on either LKUP_ID or LKUP_ID and ATTR_VAL. Think of a phone book and the way it stores and sorts information, and imagine LKUP_ID as last name and ATTR_VAL as first name. If you search for Jones and then look for Andrew the sort order in the book helps, but you can't use it to find Andrew and then filter to Jones.



Post #1371873
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse