Ask the Expert

How to speed up a composite nonclustered index-based query

Here's the situation: A composite nonclustered index is created with XYZ table with the columns ordered, seqno,del_date to improve the query below:

SELECT * FROM XYZ WHERE del_date BETWEEN @datefrom AND @dateto AND orderid=@orderid AND seqno=@seqno
ORDER BY orderid, seqno,del_date

Now, after implementing the index, the query still responds very slowly. What other steps are needed to resolve the problem?

    Requires Free Membership to View

Based on this information, you have a few different options that I think should be tested thoroughly in your development and test environment by reviewing the query plans. Here are a few high level thoughts:

  • Evaluate building a clustered index with the same column definition
  • Evaluate building a clustered index based on an identity and separate non-clustered indexes for each column
  • Evaluate building three separate non-clustered indexes for each of the columns

This was first published in December 2005

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: