You are on page 1of 17

TRNG H S PHM TP.

H CH MINH Khoa Cng ngh Thng tin Lp S phm Tin 3

ADB ti nghin cu:

JOIN TEMPORAL (Explicit Algorithms)


Nhm 04: Kim Duyn + Hong Hip + Khnh Ha + Hng Ninh

NI DUNG TRNH BY
1. 2. 3. 4. 5. Temporal DataBase. Join in Temporal DB. Query Proccessing. Explicit Algorithms. Applications of Temporal DB.

1. TEMPORAL DATABASE
Trong c s d liu hng thi gian. Lc quan h c biu din nh sau:

R = (A1,..,An,Ts,Te) S = (B1,..,Bm,Ts,Te)
Thuc tnh tng minh (Explicit attributes)
Ta dng T = [Ts,Te] vit tt cp thuc tnh thi gian

Thuc tnh thi gian (Timestamp attributes)

1. TEMPORAL DATABASE
Example: Hai quan h thi gian
Employee
EmpName Ron George Ron Dept Ship Ship Mail T [1,5] [5,9] [6,10]

Manage
Dept Ron George MgrName Ed Jim T [3,8] [7,15]

2. JOIN IN TEMPORAL DATABASE


a. The goals join operator:
- Php kt gip ta truy xut d liu trn nhiu bng trong c s d liu. - Php kt l ton t quan trng nht: C tm nh hng to ln, quyt nh phn nhiu tc qu trnh x l ca cc lnh truy vn.

2. JOIN IN TEMPORAL DATABASE


b. Temporal Cartesian Product:
Employee (R) EmpName Dept Ron Ship George Ship Ron Mail

T x s

- Tng t nh php tch Descartes thng thng i vi cc thuc tnh tng minh (Explicit Attributes).
T [1,5] [5,9] [6,10] Manage (S) Dept MgrName T Ron Ed [3,8] George Jim [7,15]

Employee T Manage EmpName Dept Dept

MgrName Ed Ed Jim Ed Jim

T [3,5] [5,8] [7,9] [6,8] [7,10]

Tm khong chung T gia 2 khong RT v ST.

Ron George George Ron Ron

Ship Ship Ship Mail Mail

Load Load Ship Load Ship

2. JOIN IN TEMPORAL DATABASE


b. Temporal Cartesian Product: r

T x s

- Hm giao nhau overlap(U,V): tr v khong thi gian ti a cha trong 2 khong thi gian v nu khng c phn giao
, = , , , ( , ,

= ++ , ( = = = , [] )

2. JOIN IN TEMPORAL DATABASE


c. Theta Join:

( )

l mt k hiu trong thuc tnh tng minh (explitict hay nontemporal) ca r v s.

d. Equijoin:

Thuc tnh A A v B B c nh ngha nh php kt theta vi thuc tnh r[A] = s[B]

Ngoi ra cn c cc php kt Natural join, Outer join, TEjoin tng t vi cc php kt trn nhng c phn phc tp hn.

3. QUERY PROCESSING
- Mt trong nhng nhim v quan trng nht ca mt h qun tr CSDL l tm ra mt chin lc nh gi cho cu truy vn.

Quy trnh truy vn

4. EXPLICIT ALGORITHMS
- Thut ton vng lp lng nhau (Nested Loop-Based Algorithms) So snh tt c cc cp ca b d liu thnh cc mi quan h u vo. - Thut ton sp xp hp nht (Sort Merge-Based Algorithms) Sp xp cc mi quan h u vo. - Thut ton phn vng (Partition-Based Algorithms) Phn chia cc b d liu u vo thnh nhm s dng cc thuc tnh kt. Buckets bao gm tt c cc b tng ng ph hp. Buckets c xy dng s dng tt nht chnh l khng gian b nh m c sn.

4. EXPLICIT ALGORITHMS
a. Nested Loop-Based Algorithms:

4. EXPLICIT ALGORITHMS
b. Sort Merge-Based Algorithms:
- Thut ton ny c chia lm 2 giai on:

Giai on 1: Cc quan h u vo r v s c sp xp da cc thuc tnh kt. Giai on 2: Thc hin ng thi 2 cng vic d tm cc b ging nhau v hp nht chng li da trn cc thuc tnh kt.

- Lu : Khi c nhiu thuc tnh ging ht nhau th thut ton s dng ch sao lu m bo tt c cc thuc tnh u c tham gia thut ton.

4. EXPLICIT ALGORITHMS
b. Sort Merge-Based Algorithms:

4. EXPLICIT ALGORITHMS
c. Partition-Based Algorithms:
- Thut ton ny c chia lm 2 giai on:
Giai on 1: Cc quan h u vo r v s c phn chia da cc thuc tnh kt. Kt qu ca php phn chia ny l nhng mng d liu (buckets) Giai on 2: So snh cc b d liu tng ng c cha trong nhng mng bucket. Kt qu l cc b ca php kt.

4. EXPLICIT ALGORITHMS
c. Partition-Based Algorithms:

5. APPLICATIONS OF TEMPORAL DB
Lnh vc y t: Lu tr li cc thng tin lch s khm bnh ca bnh nhn. Lnh vc ti chnh: Thng tin gi c phiu, chng khong theo ti tng thi im. Lnh vc ngn hng: Lu li lch s np tin v rt tin ca khch hng s dng th ATM. Lnh vc thin vn: Lu li du vt di chuyn ca nhng cn bo ti tng thi im.

THE END!!!
THANKS!