Todos os livros

Profissional

Apps Sobre Coach Entrar Começar a ler

Computer Science · Glossário

O que é Nested-loop, block nested-loop, index nested-loop, sort–merge and hash joins?

Também chamado de: nested-loop join · block nested-loop join · index nested-loop join · sort--merge join · hash join

Definition 22.4 University Computer Science — Year 3 · Capítulo 22 — Query Processing and Optimisation

Let RR have MM pages and ∣R∣|R| tuples, SS have NN pages, and BB buffer pages be free. The nested-loop join scans SS once for each tuple of RR: M+∣R∣NM + |R| N page reads. The block nested-loop join loads B−2B - 2 pages of RR at a time and scans SS once per block: M+⌈M/(B−2)⌉NM + \lceil M/(B-2) \rceil N. The index nested-loop join searches an index on SS’s join column for each tuple of RR: M+∣R∣(h+1)M + |R|(h + 1) for an index of height hh and one matching tuple. The sort–merge join sorts both inputs on the join column and merges them: the two sorts plus M+NM + N. The hash join builds a hash table on the smaller input and probes it with the other: M+NM + N if the smaller fits in B−2B - 2 pages; otherwise the Grace variant first partitions both inputs into B−1B - 1 buckets on disk by a hash of the join column and joins bucket by bucket: 3(M+N)3(M + N).

Counted page I/O of four joins as R grows from 100 to 1,000 pages, S fixed at 100 pages, 12 buffer pages. The tuple nested loop is off the chart: 100,100 already at M = 100.
Counted page I/O of four joins as RR grows from 100 to 1,000 pages, SS fixed at 100 pages, 12 buffer pages. The tuple nested loop is off the chart: 100,100 already at M=100M = 100.
Ler no capítulo →