Table of Contents

Cviceni 2

Typické statistiky pro tabulky

nR # of tuples (rows) of relation R
V(A,R) # of R[A] (# of different values A in relation R)
pR # of pages to store R
bR block factor (how many tuples(rows) in average fit into a block
M # of a free memory for query processing (in db blocks)
l(A,R) # of levels of index tree for key A indexing R

Typické statistiky pro indexy

f(A,R) average # of followers (childs) of branch node
(~50-100 in real DBs)
I(A,R) # levels of index tree
(~2-3 in real DBs) ~ log(V(A,R))/log(f(A,R))
p(R,A) # of leafs blocks

Vypocty cen

Teorie

B-INDEX

CLUSTER

INDEX ORGANISED TABLE

Příklady

Table statistics

EMP:

DEPT:

SELECT

SELECT * FROM EMP WHERE EMPNO = 745
SELECT * FROM EMP WHERE EMPNO > 150
SELECT * FROM EMP WHERE EMPNO < 151

JOIN

Nested loop

SELECT * FROM DEPT D, EMP E WHERE D.DEPTNO = E.DEPTNO

Merge join