Yes hints are evil, because they circumvent the entire beauty of runtime query optimizers. However if you really do know whats best and know that your query optimizer really does not know whats best, even if you make sure the table stats etc are all in order you can decide that "hardcoding" the query execution plan is best.
Now SQL tuning books devote entire chapters on how to add redundant where conditions, redundant additions and multiplications. The last such chapter I have read was in "SQL tuning". There it gave a tip on how to control the order in which joins are done using the following trick:
... AND T1.Key2_ID=T2.Key2_ID
AND T1.Key3_ID+0*T2.Key2_ID=T3.Key3_ID ...
Now this is getting insane! It seems obvious that there is a demand for being able to restrict or even hardcode the entire query execution plan! However the SQL standard is …
[Read more]