SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single...
Transcript of SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single...
![Page 1: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/1.jpg)
SimpleDB OverviewCSE444– Section1
1
![Page 2: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/2.jpg)
Today…
• DemoGit/EclipseSetup• GothroughanoverviewofSimpleDB
2
![Page 3: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/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: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/4.jpg)
WhatyoushouldNOTdo:
•Modifygivenclasses• Removing,renaming,relocatingtootherpackages
•Modifygivenmethods• Changingparametersorreturntypes
• Usethird-partylibraries• Excepttheonesunderlib/directory• YoucandoeverythingusingregularJavalibraries
4
![Page 5: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/5.jpg)
WhatyouCANdo:
• Addnewclasses/interfaces/methods/packages•Watchoutfornameconflictswithfuturelabs!• Saferchoice:usenewpackages(best)orinnerclasses(meh)
• Re-implementprovidedmethods• Justdon’tdestroycorrectnessorspecification!
• Findbugs!
5
![Page 6: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/6.jpg)
• Systemtestcases• Undertest/systemtest•We’llgradeusingadditionaltests
•Writeup• Explainwhydoyouimplementinthatway
•We’llreadyourcode• Readinghorriblecodeishorrible,sospendsometimepolishing• Passingallthetestcasesmaynotnecessarymeanyou’llgetahighscore
6
WhatyouCANdo(continued):
![Page 7: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/7.jpg)
SettingupSimpleDBAnyquestionsorconcerns?
7
![Page 8: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/8.jpg)
OverviewofSimpleDB
8
![Page 9: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/9.jpg)
Database
•Asingledatabase• Oneschema• Listoftables
•Referencestomajorcomponents• GlobalinstanceofCatalog• GlobalinstanceofBufferPool
9
![Page 10: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/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: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/11.jpg)
BufferPool
•TheONLYbridgebetweendata-processingoperatorsandactualdatafiles• Strictinterfaceforphysicalindependence!
•Datafilesareneveraccesseddirectly• Laterlabs:• Lockingfortransactions• Flushingpagesforrecovery
11
![Page 12: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/12.jpg)
DataTypes
•Integer• Type.INT_TYPE• 4bytewidth
•Fixed-lengthStrings• Type.STRING_TYPE• 128byteslong(Type.STRING_LEN)• Donotchangethisconstant!
12
![Page 13: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/13.jpg)
DbIterator
•Ancestorclassforalloperators• Join,Project,SeqScan,etc…
•Eachoperatorhasmethods:• open(),close(),getTupleDesc(),hasNext(),next(),rewind()
• Iteratormodel:chainiteratorstogether
13
![Page 14: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/14.jpg)
HeapFile
•Mainclassthatorganizesthephysicalstorageoftables•CollectionofHeapPages ondisk• OneHeapFile foreachtable• Fixed-sizepagesmeansefficientlookupofpages
HeapPage #1
HeapPage #2
HeapPage #3
14
![Page 15: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/15.jpg)
15
![Page 16: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/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: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •](https://reader034.fdocuments.in/reader034/viewer/2022052017/60305639257ca06250398b53/html5/thumbnails/17.jpg)
Questions?
17