The question is quite simple: What can I do to make sure that the SQL Server query optimizer has all the information it needs to choose the "best" query plan?
The background of this question is that recently we've run into more and more cases where SQL Server chooses a bad query plan, i.e., cases, where adding query hints, join hints or explicitly using temporary tables instead of "one big SQL" drastically improved performance. I'm actually quite surprised that the query optimizer delivers such a lot of bad results, so I'm wondering whether we did something wrong. No indexes are missing (according to query analyzer and common sense), and statistics are updated frequently by a maintainance task.
Let me emphasize that I am not talking about missing indexes here! I'm talking about the situation where there is a "good" and a "bad" query plan (given the current state of the DB), and SQL Server chooses a "bad" plan although the indexes present would allow it to use a "good" plan. I'm wondering whether there is some possibility to improve the results of the query optimizer without having to optimize all queries manually (with query hints or USE PLAN).