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


I'm not sure what the inequality column means for the index


I'm not sure what the inequality column means for the index

Author
Message
Douglas Osborne-456728
Douglas Osborne-456728
Old Hand
Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)

Group: General Forum Members
Points: 336 Visits: 327
Jesse,

I ran the SQL - I have one entry with a score of 119,567. It is displaying equality_columns of StrategyCode and HistoryDate on one table - no inequality columns - so I'd create an index on StrategyCode, HistoryDate?

I have another table where the sole entry is under inequality_columns - RRCode - so I'd make an index on RRCode?

I have a third table where I have TransactionAction, TransactionEntityType under equality_columns and ProcessStatusFlag under inequality_columns.

Is this telling me to make 2 indexes - or 1 index of TransactionAction, TransactionEntityType and ProcessStatusFlag?

TIA,
Doug
YeshuaAgapao
YeshuaAgapao
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1267 Visits: 211
Yes for the first two:

StrategyCode, HistoryDate
RRCode

3rd:

one index on TransactionAction, TrasactionEntityType,PrcessStatusFlag

Don't neglect the includes

The missing index views don't account for clustered index inheritance. Clustered index seek columns are appended to the end as seeks to every non-unique nonclustered index, and as includes to every unique nonclustered index.

SQL Server will never seek any further keys on and index beyond the one it has to seek on an inequality operation. So put all the equalities first, and then the inequalities. Preferabbly find the one most-used (unless some other queries seek it as an equality) and relegate the rest to includes since they'll never get used.



Douglas Osborne-456728
Douglas Osborne-456728
Old Hand
Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)

Group: General Forum Members
Points: 336 Visits: 327
Jesse,

I lost the link to this topic - do you have the URL of your script?

Thanx,
Doug
YeshuaAgapao
YeshuaAgapao
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1267 Visits: 211
http://www.sqlservercentral.com/scripts/Index+Management/63937/

There seems to be one other topic that has the same problem also - What to do with Multiple Similar Index Reccommendations



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