Basis Data Tersebar

Document Sample
Basis Data Tersebar Powered By Docstoc
					                                                           Materi VII: Distributed Query Processing


   Query Processing:

                                       High level user query


                                            Query
                                           Processor


                                    low level data manipulation
                                            commands

   Komponen-komponen query processing:
       Query language
       Metodologi eksekusi query
       Optimasi query

   Proses seleksi alternatif:
    Contoh:
       SELECT ENAME
       FROM EMP,ASG
       WHERE EMP.ENO = ASG.ENO
       AND DUR >37

       Strategy 1:
        ENAME (  DUR 37  EMP. ENO  AS . ENO (EMP×ASG))
       Strategy 2:                                                          Mana yang lebih baik ?

       Π ENAME (EMP          ENO   (  DUR37 (ASG)))

   Masalahnya?




                  Strategy 2: plan 1                   Strategy 2: plan 2




                                                                            Modul Basis Data Tersebar
                                                     Materi VII: Distributed Query Processing


   Pertimbangan biaya (cost)
    Asumsi:
         size(EMP) = 400 dan jumlah rekordnya 20, size(ASG) = 1000 dan jumlah rekordnya 20
         tuple access cost = 1 unit; tuple transfer cost = 10 units
    Strategi 2 plan 1:
         produce ASG': (10+10).tuple access cost 20
         transfer ASG' to the sites of EMP: (10+10).tuple transfer cost 200
         produce EMP': (10+10) .tuple access cost 2 40
         transfer EMP' to result site: (10+10) .tuple transfer cost 200
         Total cost 460
    Strategi 2 plan 2:
         transfer EMP to site 5:400 tuple transfer cost 4,000
         transfer ASG to site 5 :1000 tuple transfer cost 10,000
         produce ASG':1000 tuple access cost 1,000
         join EMP and ASG':400 20 tuple access cost 8,000
         Total cost 23,000

   Distributed Query Processing Methodology




   Step 1: Query Decomposition
     Analisa
            Contoh 1:
                SELECT ENAME,RESP
                FROM EMP, ASG, PROJ
                WHERE EMP.ENO = ASG.ENO
                AND ASG.PNO = PROJ.PNO
                AND PNAME = "CAD/CAM"
                AND DUR = 36
                AND TITLE = "Programmer"




                                                                  Modul Basis Data Tersebar
                                              Materi VII: Distributed Query Processing




      Contoh 2:
          SELECT ENAME,RESP
          FROM EMP, ASG, PROJ
          WHERE EMP.ENO = ASG.ENO
          AND PNAME = "CAD/CAM"
          AND DUR = 36
          AND TITLE = "Programmer"




 Penyederhanaan
       SELECT TITLE
       FROM EMP
       WHERE EMP.ENAME = “J. Doe”
       OR (EMP.TITLE = “Programmer”)
       AND NOT (EMP.TITLE = “Programmer”
       OR EMP.TITLE = “Elect. Eng.”)
       AND NOT (EMP.TITLE = “Elect. Eng.”))


        SELECT TITLE
        FROM EMP
        WHERE EMP.ENAME = “J. Doe”

 Restrukturisasi
  Transformation Rules:




                                                           Modul Basis Data Tersebar
                                             Materi VII: Distributed Query Processing




Contoh Restrukturisasi:
     Find the names of employees other than J. Doe who worked on the CAD/CAM
     project for either one or two years.
         SELECT ENAME
         FROM PROJ, ASG, EMP
         WHERE ASG.ENO=EMP.ENO
         AND ASG.PNO=PROJ.PNO
         AND ENAME ≠ “J. Doe”
         AND PROJ.PNAME=“CAD/CAM”
         AND (DUR=12 OR DUR=24)




                                                          Modul Basis Data Tersebar
                                                         Materi VII: Distributed Query Processing


       Hasil Restrukturisasi:




   Step 2: Data localization (fragment mana yang terlibat dan optimasi)




   Eliminasi pekerjaan yang tidak perlu : Reduksi untuk PHF




                                                                       Modul Basis Data Tersebar
                                                        Materi VII: Distributed Query Processing


   Eliminasi pekerjaan yang tidak perlu : Reduksi untuk VF




   Eliminasi pekerjaan yang tidak perlu : Reduksi untuk DHF




                                                                     Modul Basis Data Tersebar
                                                        Materi VII: Distributed Query Processing




   Eliminasi pekerjaan yang tidak perlu : Reduksi untuk HF




                                                                     Modul Basis Data Tersebar