Query considerations

Once we have primary and foreign key indexes in place, the next step is to create additional non-clustered indexes to support queries in the database. This is generally going to be done later in the development process because we won't know what queries will be executed against the database until the application is more mature. We may be able to anticipate which non-clustered indexes are needed in some cases, but, for the most part, the way to index for queries is to test the system with a dataset that is representative of the anticipated production data and analyze the query execution plans. Be sure that columns being used for joins and filter predicates are indexed, and follow the guidelines listed previously as to ...

Get Learn T-SQL Querying now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.