1 / 14

Indexering in databases

Indexering in databases. Het probleem. Het probleem. Ongeveer 10.000.000 auto’s in Nederland Query: zoek op kenteken Aannames Een tuple (record) kost ongeveer 400 bytes Een disk block bevat 8 kbyte , dus 20 records per block Een disk IO kost 5 msec

Download Presentation

Indexering in databases

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Indexering in databases

  2. Het probleem

  3. Het probleem • Ongeveer 10.000.000 auto’s in Nederland • Query: zoek op kenteken • Aannames • Eentuple (record) kostongeveer 400 bytes • Een disk block bevat 8 kbyte, dus 20 records per block • Een disk IO kost 5 msec • Maximalezoektijd (volledige table scan) • 10.000.000 / 20 = 500.000 disk IO • 2500 sec = 41:40 minuten • Gewenstezoektijd: < 1 sec

  4. Main memory vsharddisk • Main memory • Typical size : 4 – 256 GB • Access time: 100 nsec • Volatile • Harddisk • Typical size : 0.5 – 4 TB • Access time: 5 msec (without clustering) • Non-volatile • Unit of traffic: block (2 – 32 kbyte)

  5. Hard disk

  6. De oplossing: indexering • Indexeringsteltons in staatomsneltezoeken op de waarde van eenattribuut • Indexeringondersteuntookingewikkeldevormen van query processing • Indexeringondersteunt primary key en uniqueness constraints

  7. Indexering: hoe doe je dat? Twee fundamenteletechnieken • Zoekboom • Hash index Beideprincipestoepasbaarvoorzowel main memory als harddisk

  8. Boom volgensinformatici

  9. Binairezoekboom

  10. Intermezzo • Voeg toe: 2 18 9 5 • Hoeveel knopen passen in de boom bij hoogte 10? • Hoeveel knopen passen in de boom bij hoogte N? • Hoeveel kost een zoekactie in een boom van grootte M doorgaans? • Voeg toe: 20 30 40 60 50

  11. Binairezoekboom: balancering

  12. B-tree (main memory & harddisk)

  13. B-tree: karakteristieken • Veld: 4 byte integer • Pointer: 8 bytes • Block size: 8 kbyte • Vulling: 341 – 683 • 2 nivo’s: minimaal 116281 • 3 nivo’s: minimaal 39.651.621 • 4 nivo’s: minimaal13.521.270.961

  14. Hash table • Reserveer 0..N buckets • Hashfunctief • Domein: allemogelijkeattribuutwaarden • Bereik: 0..N • Netjesverdeeld

More Related