Вопрос

I am learning about query optimization. In general, applying PROJECT and SELECT before JOIN will give you better performance. My question is:

Are there any cases that applying SELECT operation before applying JOIN operation or applying PROJECT operation before applying JOIN operation will be better?

Thanks for any response.

Это было полезно?

Решение

"Pushing selections" down is one of the basic optimization strategies which can reduce the amount of I/Os that need to be done .

For instance , a selection containing a sargable predicate, if pushed under the join , will effectively reduce the number of I/Os by reducing the number of tuples in the outer relation (Nested Loops Join requires |R|+|R|*|Q| I/Os) .

The main downside of pushing selections down is the situation in which the existing indices on the original relation cannot be used. The decision of whether to push or not is done in conjunction with the choice of the join method.

Similarly, you can "push" a projection down if it retains the attributes needed for the join.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top