Here, we write a subquery in the FROM clause that explicitly joins the desired tables. The following two techniques are pretty similar: both rewrite the query to use a subquery and prevent the optimizer from pulling it up. Therefore, we are looking for optimizer barriers, that is SQL constructs that prevent PostgreSQL from rearranging the plan. But if we want to force the optimizer’s hand, we want to prevent exactly that. Usually that is just what you want: the more ways the optimizer finds to execute the query, the better its chances are of finding the fastest execution plan.
0 Comments
Leave a Reply. |