Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Indexes

Author  Topic 

ramdas
Posting Yak Master

181 Posts

Posted - 2002-09-19 : 23:03:59
Hi Folks,
I have a table which has the following structure:

Create table individual_response(
individual_id int,
survey_id int,
survey_question_id int,
response int)

There is a clustered index on individual_id and a nonclustered index on (survey_id,survey_question_id). I have a query which looks for records based on individual_id like
SELECT * FROM individual_response WHERE individual_id IN (2,8,20). Is having a clustered index on individual_id a good choice.

2. The number individual_id's in the where clause can vary, at times here may be three id's and at times 12.
3. When I used the survey_id and survey_question_id in the where clause, will the non-clustered index be used as a covering index.

Will current indexing structure on the table work for these kind of queries.


Any ideas/thoughts is appreciated.
Bye


Ramdas Narayanan
SQL Server DBA

lozitskiy
Starting Member

28 Posts

Posted - 2002-09-20 : 09:27:55
As for me it needs to create nonclustered index on (individual_id, survey_id, survey_question_id). This index is covering index.
Also I recommend to add Id field with unique clustered index.

-------------
MCP MSSQL
Go to Top of Page

ramdas
Posting Yak Master

181 Posts

Posted - 2002-09-20 : 09:51:52
Hi,
Thanks for your reply.
Bye

Ramdas Narayanan
SQL Server DBA
Go to Top of Page
   

- Advertisement -