| SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it. |
|
|||
Which Plan is the most efficient one?Hello,
I have been trying to fine tune a query that involves this one table. The table contains 725,027 rows. Plan 1 The original query completes in 6.2 seconds. The optimizer makes use of the clustered index. Performs a clustered index scan. The primary key is not used in the query. Physical operation: Clustered Index Scan Row Count: 725,027 I/O cost: 6.73 CPU cost: 0.39 Number of executes: 2 Cost: 3% Estimated row count: 723,244 Plan 2 I created a covering index. Completes in 1.72 seconds. Uses the covering index but performs an index scan. Physical operation: Index Scan Row Count: 725,027 I/O cost: 3.09 CPU cost: 0.79 Number of executes: 1 Cost: 11% Estimated row count: 723,244 Plan 3 I used 'set forceplan'. Completes in 2.31 seconds. Uses the covering index. Performs an Index Seek. Physical operation: Index Seek Row Count: 20,215 I/O cost: 0.00320 CPU cost: 0.000080 Number of executes: 10449 Cost: 22% Estimated row count: 1 Plan 3 performs a seek, I/O and CPU is good BUT the number of executes is too high. Reads are high. Would like to know which plan is ideal with regard to this table? Thank you. |
|
Be the first to answer this question! Click on the 'Post Reply' button below.
|