Database Systems · Join Order, Merge Join Seek-Transfer Model and Non-Key Index Join
The Cost Model: Seeks and Transfers
This chapter is about the cost of joins: how many block transfers and seeks each join algorithm needs, how to estimate the size of a join's output, and how to pick the order in which to join three or more relations. We work in the seek-and-transfer cost model used by Silberschatz–Korth–Sudarshan (SKS) and by most GATE questions.
We measure the cost of a query plan by two numbers:
- = time to transfer one block (sequential read/write).
- = time to seek (random access) to a block.
Total cost , where = number of block transfers and = number of seeks. GATE usually asks for the pair or for the cost with given.
Notation (SKS convention, used throughout unless stated):
| Symbol | Meaning |
|---|---|
| number of blocks of relation | |
| number of tuples of relation | |
| number of distinct values of attribute in | |
| number of main-memory blocks available for the join | |
| number of buffer blocks per input in merge join | |
| height of a B⁺-tree index (number of index levels) |