(1) Duplicate elimination using sorting
The objective of this approach is to sort the tuples of the reduced relation using all the
remaining attributes as the sort key. This has the effect of arranging the tuples in such
a way that duplicates are adjacent and can be removed easily thereafter. To remove
the unwanted attributes, we need to read all tuples of R and copy the required attributes
to a temporary relation, at a cost of nBlocks(R). The estimated cost of sorting is
nBlocks(R)*[log2(nBlocks(R))], and so the combined cost is