Database Management Systems For Mobile   Devices <ul><li>Robert L. Foster Jr. </li></ul><ul><li>November 18, 2008 </li></ul>
Light Weight DBMS? <ul><li>Definition </li></ul><ul><li>Purpose </li></ul><ul><li>Examples </li></ul><ul><li>Tradeoffs </l...
Formal Definition <ul><li>There isn’t one... </li></ul><ul><li>Major DBMS’s can run on most operating systems providing fu...
DBMS For Mobile Devices <ul><li>DBMS’s for mobile device should be dedicated to optimizing at least one of the following, ...
Power Optimization <ul><li>Mobile devices such as laptops, cell phones, PDA’s, and radios have a limited power supply. </l...
Power Optimization Continued... <ul><li>Query </li></ul><ul><li>Add </li></ul><ul><li>Delete </li></ul><ul><li>Atomicity? ...
Memory Management <ul><li>How much memory is available on the device at any given time? </li></ul><ul><li>How much of the ...
Examples <ul><li>There are numerous “light weight” DBMS’s dedicated to addressing these specific issues. </li></ul><ul><li...
Examples <ul><li>What’s good for the goose is not necessarily what’s good for the gander... </li></ul><ul><li>Mobile phone...
Metrics <ul><li>What should we consider when choosing a light weight DBMS for a device? </li></ul><ul><ul><li>Operating Sy...
Metrics Continued... Capabilities? <ul><li>Union </li></ul><ul><li>Intersect </li></ul><ul><li>Inner Joins </li></ul><ul><...
Options <ul><li>SQLite </li></ul><ul><li>SmallSQL </li></ul><ul><li>Pyrrho DBMS </li></ul><ul><li>ScimoreDB </li></ul><ul>...
HSQLDB <ul><li>Hyperthreaded Structured Query Language </li></ul><ul><li>Written in Java </li></ul><ul><li>Offers JDBC Dri...
ScimoreDB Embedded <ul><li>Distributed Query Language (DQL) </li></ul><ul><ul><li>Text based query language </li></ul></ul...
SmallSQL <ul><li>Java  </li></ul><ul><li>JDBC Driver </li></ul><ul><li>200k </li></ul><ul><li>No Installation Required </l...
SQLite <ul><li>ACID </li></ul><ul><li>C </li></ul><ul><li>Cross Platform </li></ul><ul><li>500K </li></ul><ul><li>Uses a S...
SQLite Continued... <ul><li>Not a stand alone process </li></ul><ul><li>A library? </li></ul><ul><li>Linked Function Calls...
More on SQLite <ul><li>SQLite3 - Stand alone application provides: </li></ul><ul><ul><li>create database </li></ul></ul><u...
SQLite Code Samples <ul><li>Because of weak typing and the use of a single database file several layers may be necessary. ...
Code Samples Continued... <ul><li>DatabaseManager #include &quot; SQLDatabaseCalls.h &quot; //Basic Interface Provided to ...
Code Samples Continued... <ul><li>Client Code  # include  &quot; DbManager.h &quot; //Uses The DatabaseManager and handles...
SQLite IRL <ul><li>125 million copies in Mozilla Firefox. </li></ul><ul><li>20 million Mac OS X computers, each of which c...
Tradeoffs <ul><li>Incomplete Functionality </li></ul><ul><li>Support </li></ul><ul><li>ACID compliance  </li></ul><ul><li>...
References <ul><li>“ Comparison of relational database management systems.”  Wikipedia: The Free Encyclopedia.  15 Novembe...
Upcoming SlideShare
Loading in …5
×

Database Management Systems For Mobile Devices

1,419 views
1,362 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,419
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
89
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Database Management Systems For Mobile Devices

  1. 1. Database Management Systems For Mobile Devices <ul><li>Robert L. Foster Jr. </li></ul><ul><li>November 18, 2008 </li></ul>
  2. 2. Light Weight DBMS? <ul><li>Definition </li></ul><ul><li>Purpose </li></ul><ul><li>Examples </li></ul><ul><li>Tradeoffs </li></ul>
  3. 3. Formal Definition <ul><li>There isn’t one... </li></ul><ul><li>Major DBMS’s can run on most operating systems providing full functionality: MySQl Oracle etc... </li></ul><ul><li>What about embedded systems? </li></ul><ul><li>Why do we need one? </li></ul>
  4. 4. DBMS For Mobile Devices <ul><li>DBMS’s for mobile device should be dedicated to optimizing at least one of the following, preferably both: </li></ul><ul><ul><li>power optimization </li></ul></ul><ul><ul><li>memory management </li></ul></ul><ul><li>commonality: small footprints </li></ul>
  5. 5. Power Optimization <ul><li>Mobile devices such as laptops, cell phones, PDA’s, and radios have a limited power supply. </li></ul><ul><li>How can we optimize our DBMS to use as few resources as possible while providing the necessary functionality? </li></ul><ul><li>What is the necessary functionality for a mobile device? </li></ul>
  6. 6. Power Optimization Continued... <ul><li>Query </li></ul><ul><li>Add </li></ul><ul><li>Delete </li></ul><ul><li>Atomicity? </li></ul>
  7. 7. Memory Management <ul><li>How much memory is available on the device at any given time? </li></ul><ul><li>How much of the devices internal memory should be dedicated to the DB? </li></ul><ul><li>How frequently can disk accesses be made before latency issues arise? </li></ul>
  8. 8. Examples <ul><li>There are numerous “light weight” DBMS’s dedicated to addressing these specific issues. </li></ul><ul><li>How do we choose which system is the best for a given device? </li></ul>
  9. 9. Examples <ul><li>What’s good for the goose is not necessarily what’s good for the gander... </li></ul><ul><li>Mobile phones have increasingly larger amounts of memory, and faster internet connections. </li></ul><ul><li>Multi-Touch technology and GPS capabilities are a drain on batteries, and memory. </li></ul>
  10. 10. Metrics <ul><li>What should we consider when choosing a light weight DBMS for a device? </li></ul><ul><ul><li>Operating System </li></ul></ul><ul><ul><li>Acidity </li></ul></ul><ul><ul><li>Contents (Blobs, Clobs, etc...) </li></ul></ul><ul><ul><li>Max Sizes: </li></ul></ul><ul><ul><ul><li>Database </li></ul></ul></ul><ul><ul><ul><li>Tables </li></ul></ul></ul><ul><ul><ul><li>Row Size </li></ul></ul></ul><ul><ul><ul><li>Columns Per Row </li></ul></ul></ul><ul><ul><ul><li>Views (caching) </li></ul></ul></ul>
  11. 11. Metrics Continued... Capabilities? <ul><li>Union </li></ul><ul><li>Intersect </li></ul><ul><li>Inner Joins </li></ul><ul><li>Outer Joins </li></ul><ul><li>Merge </li></ul><ul><li>Language? </li></ul><ul><li>Cost </li></ul>
  12. 12. Options <ul><li>SQLite </li></ul><ul><li>SmallSQL </li></ul><ul><li>Pyrrho DBMS </li></ul><ul><li>ScimoreDB </li></ul><ul><li>HSQLDB </li></ul><ul><li>Embedded MySQL </li></ul>
  13. 13. HSQLDB <ul><li>Hyperthreaded Structured Query Language </li></ul><ul><li>Written in Java </li></ul><ul><li>Offers JDBC Driver </li></ul><ul><li>100-600k </li></ul><ul><li>Cross Platform </li></ul><ul><li>OpenOffice & Mathematica </li></ul>
  14. 14. ScimoreDB Embedded <ul><li>Distributed Query Language (DQL) </li></ul><ul><ul><li>Text based query language </li></ul></ul><ul><li>Windows Only </li></ul><ul><li>C++ </li></ul><ul><li>ACID </li></ul><ul><li>Independent process or part of your application </li></ul><ul><li>Free </li></ul><ul><li>4MB (A relatively small footprint in comparison) </li></ul>
  15. 15. SmallSQL <ul><li>Java </li></ul><ul><li>JDBC Driver </li></ul><ul><li>200k </li></ul><ul><li>No Installation Required </li></ul><ul><li>Provides no network interface or user management...so what’s it good for? </li></ul>
  16. 16. SQLite <ul><li>ACID </li></ul><ul><li>C </li></ul><ul><li>Cross Platform </li></ul><ul><li>500K </li></ul><ul><li>Uses a Single Database File </li></ul><ul><li>FREE! </li></ul>
  17. 17. SQLite Continued... <ul><li>Not a stand alone process </li></ul><ul><li>A library? </li></ul><ul><li>Linked Function Calls </li></ul><ul><li>Dynamically Typed (Read Weakly) </li></ul><ul><li>C, C++, Java, C#, and LISP bindings available </li></ul><ul><li>SQLite3 </li></ul>
  18. 18. More on SQLite <ul><li>SQLite3 - Stand alone application provides: </li></ul><ul><ul><li>create database </li></ul></ul><ul><ul><li>define tables </li></ul></ul><ul><ul><li>insert and change rows </li></ul></ul><ul><ul><li>run queries </li></ul></ul><ul><ul><li>manage database </li></ul></ul><ul><li>Single application (Resides on the host machine) </li></ul>
  19. 19. SQLite Code Samples <ul><li>Because of weak typing and the use of a single database file several layers may be necessary. </li></ul><ul><li>SQLiteDatabaseCalls #include &quot; sqlite3.h &quot; /*Minimal SQLite3 Interface this provides the only access to SQLite3 library functions*/ sqlite3* createDatabase( char *pFilename); int getDataFromDB(sqlite3* db, const char * sqlCommand, char ** & data, int & rows, int & cols); int clearOldData(sqlite3* db, const char * sqlCommand); int insertResults(sqlite3* db, int currentTime, const char * sqlCommand); int clearEntries(sqlite3* db, const char * sqlCommand); </li></ul>
  20. 20. Code Samples Continued... <ul><li>DatabaseManager #include &quot; SQLDatabaseCalls.h &quot; //Basic Interface Provided to Client Code void * DbHandleCreate(); int DbHandleClose( void * pHandle); bool addDatatoTable( const char * sqlCommand); bool clearTable(const char * sqlCommand); bool clearTableEntry( const char * sqlCommand); char ** queryEntry( const char * sqlCommand, int & rows, int & cols); void freeTable( char ** table); </li></ul>
  21. 21. Code Samples Continued... <ul><li>Client Code # include &quot; DbManager.h &quot; //Uses The DatabaseManager and handles all type issues and structures bool addPolicy(SPolicy* policy, SMode* oldMode, char * content); bool deletePolicy( const char * modeID, const char * policyID); bool queryPolicy( int argc, char ** argv, int & messagelen, char *& xmlBuf); bool deleteComplaint( int argc, char ** argv); bool deleteConflict( int argc, char ** argv); bool deleteMode( int argc, char ** argv); bool findComplaint( int argc, char** argv , int & messagelen, char *& xmlBuf); bool findConflict( int argc, char ** argv, int & messagelen, char *& xmlBuf); bool findDecision( int argc, char ** argv, int & messagelen, char *& xmlBuf); </li></ul>
  22. 22. SQLite IRL <ul><li>125 million copies in Mozilla Firefox. </li></ul><ul><li>20 million Mac OS X computers, each of which contains multiple copies of SQLite. (In Mac OS X v10.4 Apple introduced SQLite as a persistence layer of the Core Data API.) </li></ul><ul><li>300 million downloads of Skype. (The Skype service has 100 million registered users.) </li></ul><ul><li>Nokia phones with Symbian OS version 9.4 or later. (The first one is Nokia 5800) </li></ul><ul><li>Every iPhone and iPod touch. </li></ul><ul><li>Google Android phones like the T-Mobile G1 </li></ul>
  23. 23. Tradeoffs <ul><li>Incomplete Functionality </li></ul><ul><li>Support </li></ul><ul><li>ACID compliance </li></ul><ul><li>Boundary Limitations (Max Sizes) </li></ul><ul><li>Access Control </li></ul><ul><li>Coding/Implementation overhead </li></ul>
  24. 24. References <ul><li>“ Comparison of relational database management systems.” Wikipedia: The Free Encyclopedia. 15 November 2008 < http://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems > </li></ul><ul><li>“ SQLite.” Wikipedia: The Free Encyclopedia. 15 November 2008 < http://en.wikipedia.org/wiki/SQLite > </li></ul><ul><li>“ HSQLDB.” 15 November 2008 < http://hsqldb.org / > </li></ul><ul><li>“SmalSQL Database - the Java Desktop Database with JDBC interface.” 15 November 2008 < http://www.smallsql.de / > </li></ul><ul><li>“ Scimore - High performance distributed, client/server and fully feature embeded SQL database.” 15 November 2008 < http://www.scimore.com / > </li></ul><ul><li>“ SQLite Documentation.” 15 November 2008 < http://www.sqlite.org/docs.html > </li></ul>

×