Please enable JavaScript.
Coggle requires JavaScript to display documents.
Projection - Coggle Diagram
Projection
Project Operator
-
Hard: SELECT DISTINCT R.A, R.D
-
-
Sort-based
Naive
- Scan relation and project out atributes
-
- Scan sorted set, compare adjacent tuple, discard duplicates
-
Improve
- In pass 0, project out attributes while creating runs
-
-
- In subsequent passes, eliminate duplicates while merging runs
Hash-based (2-phase)
-
partition: not too big, otherwise repartition
-
f * T/(B-1) < B => hash table fit in memory, 2-phase
-
-
-
Comparison
Sort-based
better for skew data, duplicate data
-
if B^2 > T, I/O costs are same
Index-based
Index-only scan
-
apply projection algorithm only to data entries (key, rid)
no need to read all data, no need to project attributes
ordered index (not hash, but B+ Tree) & projection attributes as prefix of search key
-
-
- compare adjacent entries to eliminate duplicates