SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Missing Indexes


Missing Indexes

Author
Message
sunny.tjk
sunny.tjk
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1073 Visits: 1344
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?
Suresh B.
Suresh B.
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5050 Visits: 5330
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.
sunny.tjk
sunny.tjk
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1073 Visits: 1344
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.
sunny.tjk
sunny.tjk
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1073 Visits: 1344
Any suggestions, please?
dogramone
dogramone
SSC Eights!
SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)SSC Eights! (981 reputation)

Group: General Forum Members
Points: 981 Visits: 3834
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.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search