1

I'm studying size estimation of logical query plans in order to select a physical query plan.

I was wondering what is the size of joining (natural join) a relation to itself? e.g R(a,b) JOIN R(a,b)

1

Doing a natural self-join is like joining on all the columns, so like joining on the primary key (as the set of all columns is certainly a superset of the primary key.) Every row of the left copy of the table will be joined to exactly one row (its copy) of the right copy of the table.

Therefore, the size of the resulting set R NATURAL JOIN R will be exactly the same as the original R itself (actually the situation is even better, the resulting set is exactly the original R.)

If on the other side, you self-join on (one or more) columns that are not a superset of the primary key, the size can be anything from 0 rows up to the square of size(R).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.