Developer Documentation Library > Interviewer - Server > Administration and maintenance > Databases > Adding indexes to sample tables
 
Adding indexes to sample tables
UNICOM Intelligence Interviewer indexes any sample tables that it creates to provide improved performance on projects that use sample management. If you create sample tables manually outside UNICOM Intelligence Interviewer, you can set the same indexes manually on those tables to achieve the same performance gains. If you have sample tables created with UNICOM Intelligence Interviewer 3.1 or earlier you might want to add the indexes to those tables too.
You can also use these instructions as guidelines if you want to index new fields that you add to sample tables.
1 Start the SQL query analyzer: Open SQL Server Management Studio and select the New Query feature.
2 Connect to the UNICOM Intelligence Interviewer database server.
3 In the list of databases, select the sample database whose table or tables you want to index.
4 In the Query window, type the following commands. Repeat the commands for each sample table you have created manually.
For tables that are used for Web (inbound) and/or telephone interviewing (outbound) projects:
CREATE NONCLUSTERED INDEX Name_idx_id_active   ON TableName (Id, Active)
CREATE NONCLUSTERED INDEX Name_idx_queue       ON TableName (Queue)
Tables that are used for telephone interviewing projects need the following additional indexes:
CREATE NONCLUSTERED INDEX Participants_idx_activitystartTime               ON SampleTableName (ActivityStartTime)
CREATE NONCLUSTERED INDEX Participants_idx_queue_sortid_expirationtime     ON SampleTableName (Queue, SortId, ExpirationTime)
CREATE NONCLUSTERED INDEX Participants_idx_queue_apptime_expirationtime    ON SampleTableName (Queue, AppointmentTime, ExpirationTime)
CREATE NONCLUSTERED INDEX Participants_idx_queue_recalltime_expirationtime ON SampleTableName (Queue, RecallTime, ExpirationTime)
CREATE NONCLUSTERED INDEX Participants_idx_userid                          ON SampleTableName (UserId)
Tables that are used for personal interviewing projects need the following additional indexes:
CREATE NONCLUSTERED INDEX Participants_index_assignedinterviewid ON SampleTableName (AssignedInterviewerId)
CREATE NONCLUSTERED INDEX Participants_index_distributedto       ON SampleTableName (DistributedTo)
5 If you also want to index the associated history tables, type the following for each history table in the database:
CONSTRAINT Participants_ProjectName_HistoryTable_pk PRIMARY KEY CLUSTERED (Id)
CREATE NONCLUSTERED INDEX Participants_ProjectName_HistoryTable_idx           ON SampleTableName (SampleId)
CREATE NONCLUSTERED INDEX Participants_ProjectName_HistoryTable_idx_starttime ON SampleTableName (StartTime)
6 Press F5 or click Execute Query (the green triangle).
7 If you have sample tables in more than one database, select the next database from the list and repeat these commands for the tables in that database.
8 Save the changes and exit.
See also
Databases