Is it possible to give the optimizer more or all time it needs?

Next to trace flag 2301, there is 8780 which really does make the optimizer 'work harder' since it just gives it more time (not unlimited, as described in detail here (russian) and less detailed here) to do its thing.

Detailed description in english of the original author of the russian article. which includes the author's own warning:

it is not recommended ever use it in production.

Combining the two and applying them (very selectively via query hint OPTION (QUERYTRACEON 2301, QUERYTRACEON 8780) to a query of 4-level nested inline TVFs (where only the one at the bottom would do any real work and the upper levels would correlate results via EXISTS subqueries) resulted in a nice MERGE JOIN and several LAZY SPOOLs that cut down execution time by half.


No, you can't.

You can make your queries "optimiser-friendly" by understanding how it works (complex beast, not necessary to know it inside out). I'd suggest that if you something so time critical, then fix the query rather than changing how SQL Server operates.

For example, you'd want to know when a query starts scaling less efficiently than O(n) as data volume + data distribution changes: giving more time to the optimiser adds no value here.