I am inserting some records(~10k) into a temporary table using the insert into cluase. I prepared a select which will pick the indexes and perform better. But when i use the same select with "Insert into cluase" then it results in a table scan .
my query looks like this
Insert into tmpio..table
select top 10000 Column_names
from Table
where <criteria>
if i check the query plan only for the SELECT query i can see that it picks the index,but for the entire query which inclused "INSERT INTO" it doesn't pick any index.
Is this behaviour normal? Are indexes of no use when you are selecting data from one table and inserting it directly into the other table?
These are my assumptions prior to writing the query.
- Target table should not have any indexes to improve performance.
- The source table can have indexes and we can use them.