![Page 1: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/1.jpg)
SimpleDB OverviewCSE444– Section1
1
![Page 2: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/2.jpg)
Today…
• DemoGit/EclipseSetup• GothroughanoverviewofSimpleDB
2
![Page 3: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/3.jpg)
LocalRepository/home/jortiz16
GitLab IndividualRepositorygit@.../simple-db-jortiz16
GitLab CourseRepositorygit@.../simple-db
Forked(byus)
Origin RemoteCloned(byyou)
Upstream RemoteAdded(byyou)
git pushgit pull
git pullupstreammaster
Git
3
![Page 4: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/4.jpg)
WhatyoushouldNOTdo:
•Modifygivenclasses• Removing,renaming,relocatingtootherpackages
•Modifygivenmethods• Changingparametersorreturntypes
• Usethird-partylibraries• Excepttheonesunderlib/directory• YoucandoeverythingusingregularJavalibraries
4
![Page 5: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/5.jpg)
WhatyouCANdo:
• Addnewclasses/interfaces/methods/packages•Watchoutfornameconflictswithfuturelabs!• Saferchoice:usenewpackages(best)orinnerclasses(meh)
• Re-implementprovidedmethods• Justdon’tdestroycorrectnessorspecification!
• Findbugs!
5
![Page 6: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/6.jpg)
• Systemtestcases• Undertest/systemtest•We’llgradeusingadditionaltests
•Writeup• Explainwhydoyouimplementinthatway
•We’llreadyourcode• Readinghorriblecodeishorrible,sospendsometimepolishing• Passingallthetestcasesmaynotnecessarymeanyou’llgetahighscore
6
WhatyouCANdo(continued):
![Page 7: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/7.jpg)
SettingupSimpleDBAnyquestionsorconcerns?
7
![Page 8: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/8.jpg)
OverviewofSimpleDB
8
![Page 9: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/9.jpg)
Database
•Asingledatabase• Oneschema• Listoftables
•Referencestomajorcomponents• GlobalinstanceofCatalog• GlobalinstanceofBufferPool
9
![Page 10: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/10.jpg)
Catalog
•Storesmetadataabouttablesinthedatabase• voidaddTable(DbFile d,TupleDesc d)• DbFile getTable(int tableid)• TupleDesc getTupleDesc(int tableid)• …
•NOTpersistedtodisk• CataloginfoisreloadedeverytimeSimpleDB startsup
10
![Page 11: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/11.jpg)
BufferPool
•TheONLYbridgebetweendata-processingoperatorsandactualdatafiles• Strictinterfaceforphysicalindependence!
•Datafilesareneveraccesseddirectly• Laterlabs:• Lockingfortransactions• Flushingpagesforrecovery
11
![Page 12: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/12.jpg)
DataTypes
•Integer• Type.INT_TYPE• 4bytewidth
•Fixed-lengthStrings• Type.STRING_TYPE• 128byteslong(Type.STRING_LEN)• Donotchangethisconstant!
12
![Page 13: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/13.jpg)
OpIterator
•Ancestorclassforalloperators• Join,Project,SeqScan,etc…
•Eachoperatorhasmethods:• open(),close(),getTupleDesc(),hasNext(),next(),rewind()
• Iteratormodel:chainiteratorstogether
13
![Page 14: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/14.jpg)
HeapFile
•Mainclassthatorganizesthephysicalstorageoftables•CollectionofHeapPages ondisk• OneHeapFile foreachtable• Fixed-sizepagesmeansefficientlookupofpages
HeapPage #1
HeapPage #2
HeapPage #3
14
![Page 15: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/15.jpg)
15
![Page 16: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/16.jpg)
HeapPage
•A chunkofdatathatcanresideintheBufferPool•Format:Header+Tuples• #of1bitsinBitmap=#ofactivetuplesonpage
•Fixedsize:BufferPool.PAGE_SIZE Header Bitmap
Tuple #1
Tuple #2
.
.
.16
![Page 17: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page](https://reader035.vdocuments.us/reader035/viewer/2022070804/5f036dfd7e708231d4092a06/html5/thumbnails/17.jpg)
Questions?
17