Again I got a table scan. It was again between two primarykeys.
It's a insert with a select between 5 tables where the condition
is on the first table. The third table contains 10 000 000 records
and when the "query optimizer" thinks that a table scan is
faster than using the primary key the query takes 30 seconds
instead off 0.5.
I have sometimes used SET FORCEPLAN ON but it does not work
well when doing insert or update. The table that is used for
insert/update is taken as first table and that is not optimal
if the condition is on another table in the select statement.
Does anyone know if there is a way to give the complete execution
order for a query?