Invoking the dbcc trace facility

To start the dbcc traceon(302) trace facility, execute the following command from an isql batch, followed by the query or stored procedure that you want to examine:

dbcc traceon(3604, 302)

This is what the trace flags mean:

Trace flag

Explanation

3604

Directs trace output to the client, rather than to the error log.

302

Prints trace information on index selection.

To turn off the output, use:

dbcc traceoff(3604, 302)

dbcc traceon(302) is often used in conjunction with dbcc traceon(310), which provides more detail on the optimizer’s join order decisions and final cost estimates. dbcc traceon(310) also prints a “Final plan” block at the end of query optimization. To enable this trace option also, use:

dbcc traceon(3604, 302, 310)

To turn off the output, use:

dbcc traceoff(3604, 302, 310)

See “dbcc traceon(310) and final query plan costs” for information on dbcc traceon(310).