SlideShare a Scribd company logo
1 of 35
Download to read offline
Kenneth Geisshirt
kg@realm.io
Realm Inc.
@realm
http://github.com/Realm/
http://realm.io/
Is the database
a solved
problem?
Disclaimer
I work for Realm
Realm is a database vendor
I am a little biased
Agenda
• What is a database?
• The history of databases
• Relational databases, the NoSQL revolution
• Mobile platforms
• Mobile database solutions
What is a database?
• According to Wikipedia: A database is an
organized collection of data.
• Common components
• data definition (create the structure/schema)
• insert, update, delete data
• query/retrieve data
• Databases are often ACID compliant
The history
• First commercial database: IDS (1964) - a network
database
• Relational databases were developed in 1970s
• DB2, Oracle, Ingress
• Moving to the desktops in 1980s: dBASE were popular
• DotCom era - or the MySQL era (1995)
• ca. 2009: NoSQL movement
The Victory of
The Relational Database
• Relational database model dominates the world
• DB2 is heavily used by banks
• Oracle is found in large enterprises
• MySQL powers almost every web sites
• SQLite is an embedded database: initial release in
2000
SQL
• Structured Query Language is by all relational
databases
• Components
• Data definition (creating tables, …)
• Data manipulation (inserting rows, …)
• Querying
INSERT INTO Person VALUES('Kenneth', 46)
SELECT * FROM Person WHERE name = 'Kenneth'
Object-Relation Mappers
• Relational modelling
requires normalisation
• Object modelling is often a
more direct
• ORMs try to bridge the gap
Invoice
Item Number Price
CPU 1 2000
RAM 4 4000
Disk 2 6000
Z Corporation
64 Hard Drive
1024 Machineville
Line
Invoice
InvoiceID
LineID
Line
Relationalmodel
Objectmodel
End of The Relational Era
• Relational databases don’t scale well
• popular web sites are very popular (think Twitter)
• Schemas are not flexible
• normalisation leads to complex architecture
• ACID is not always a requirement
Mobile platforms
• Nokia N95 (2007)
• dual-core @ 322 MHz, 160 MB ram
• OnePlus One (2014)
• quad-core @ 2.5 GHz, 3 GB ram, 64 GB storage
• iOS and Android dominate the market
• UNIX like kernels + libraries
• Java (version 6 + some version 7), Objective C, and Swift
Mobile databases
• Three types of mobile data solutions:
• Real databases
• Data storages using SQLite as store engine
• Object Relation Mappers (ORMs) on top of
SQLite
• Library providing a SQL interface to data
• Most of SQL-92, simplified type system
• Preinstalled on iOS, Android, Windows Phone 8,
Blackberry 10
• 1.8+ billion active devices1
• Liberal license: public domain
1http://www.engadget.com/2014/06/25/google-io-2014-by-the-numbers/
SQLite on Mobile
iOS
• Rarely used directly
• Popular ORMs: Core
Data, Magical Record,
FMDB
Android
• The Java community is
highly object oriented
• Can be used directly
• Popular ORMs:
ORMLite, GreenDAO,
SugarORM, DBFlow
Core Data
• Apple’s object graph and persistent framework
• Supported under iOS and OS X
• Many storage formats: XML, binary files, SQLite
• Highly integrated into Xcode
• Part of the iOS/Cocoa SDKs
Magical Record
• Inspired by Fowler’s active record pattern and
Ruby on Rails’ Active Record
• Build on-top of Core Data
• Managed Object
• https://github.com/magicalpanda/MagicalRecord
FMDB
• Objective C wrapper around SQLite
• Major classes
• FMDatabase - “connection” to SQLite database
• FMDatabaseQueue - queue of queries and operations
• FMResultSet - results from a query
• License: MIT
• http://ccgus.github.io/fmdb/
FMDB - query
FMDatabase *db = [FMDatabase databaseWithPath:@“/tmp/tmp.db”];
[db open];
FMResultSet *s =
[db executeQuery:@"SELECT * FROM myTable”];
while ([s next]) {
// …
}
[db close];
YAP
• Key/value store
• Supports iOS (and OS X)
• SQLite is used as storage engine
• License: BSD
• https://github.com/yapstudios/YapDatabase
LevelDB
• Embedded key/value store (in C++)
• License: BSD
• https://github.com/google/leveldb
• iOS: https://github.com/matehat/Objective-LevelDB
• Android: SnappyDB uses LevelDB + additional
compression
Realm
• Realm is an object store
• Data model = classes (inheriting from a Realm
object)
• Supports iOS, Android and OS X
• Core is written in C++ and highly portable
• Custom bindings to give “native touch”
• License: Apache 2.0 (binding) + closed (core)
Realm - iOS - store
RLMRealm *realm = [RLMRealm defaultRealm];
[realm beginWriteTransaction];
Person *person = [[Person alloc] init];
person.name = @"Kenneth";
person.age = 46;
[realm addObject:person];
[realm commitWriteTransaction];
Realm - iOS - query
RLMResults *persons =
[Person objectsWhere:@"name = ‘Kenneth'"];
for (Person *person in persons) {
NSLog(@"Age:", person.age);
}
Realm - Android - store
Realm realm = Realm.getInstance(context);
realm.beginTransaction();
Person person =
realm.createObject(Person.class);
person.setName(“Kenneth”);
person.setAge(46);
realm.commitTransaction();
Realm - Android - query
RealmResults<Person> persons =
realm.where(Person.class)
.equalTo("name", “Kenneth").findAll();
for (Person person : persons) {
Log.d("REALM", "Age: " + person.getAge());
}
CouchBase Mobile
• Three components:
• CouchBase Lite: embedded database
• CouchBase Server: backend storage
• CouchBase Sync: synchronization
• Supports iOS, Android and desktop/server platforms
• Local storage is based on SQLite
• http://www.couchbase.com/nosql-databases/couchbase-mobile
CouchBase - iOS
CBLManager *manager = CBLManager sharedInstance];
CBLDatabase *database = [manager databaseNamed: dbname
error: &error];
NSDictiorary *person = @{
@"name": @"Kenneth",
@"age": @46
};
CBLDocument* doc = [database createDocument];
NSString *docID = doc.documentID;
CBLRevision *newRevision = [doc putProperties:
myDictionary error: &error];
CouchBase - Android
Manager manager = new Manager(new AndroidContext(this),
Manager.DEFAULT_OPTIONS);
Database database = manager.getDatabase("database");
Map<String, Object> docContent = new HashMap<String, Object>();
docContent.put("name", "Kenneth");
docContent.put("age", 46);
Document document = database.createDocument();
document.putProperties(docContent);
String docID = document.getId();
Parse
• Cloud database (and local storage)
• Supports iOS, Android, and Windows Phone (and
desktop/server platforms)
• Store and retrieve objects in the background
• Payment = requests per second
• https://www.parse.com
Parse - iOS - store
PFObject *person = [PFObject
objectWithClassName:@“Person”];
[person setObject:@“Kenneth”
forKey:@“name”];
[person setObject:@“46” forKey:@“age”];
[person saveInBackground];
Parse - iOS - query
PFQuery *query = [PFQuery
queryWithClassName:@“Person”];
[query whereKey:@“name” equalTo:@“Kenneth”];
[query findObjectsInBackgroundWithBlock:^(NSArray
*objects, NSError *error) {
for (PFObject *object in objects) {
NSLog(@“%@“, object[@“age”]);
}
];
Parse - Android - store
ParseObject person = new
ParseObject(“Person”);
person.put(“name”, “Kenneth”);
person.put(“age”, 46);
person.saveInBackground();
Parse - Android - query
ParseQuery<ParseObject> query = ParseQuery.getQuery(“Person”);
query.whereEqualTo(“name”, “Kenneth”);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> list, ParseException e) {
for (int i=0; i<list.size(); i++) {
Log.d(“age”, “Age: “ + list.get(i).getInt(“age”));
}
}
});
Hot topics
• Synchronisation between devices and back-end
• Often ReST services are used (with JSON)
• Parse and CouchBase Lite try to solve it
• Reactive programming
• RxJava (for Android)
• ReactiveCocoa (iOS)
The
database
is not a
solved
problemDan Strange, http://bit.ly/1QqQfEe

More Related Content

What's hot

Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?
Tim Lossen
 
Plmce2012 scaling pinterest
Plmce2012 scaling pinterestPlmce2012 scaling pinterest
Plmce2012 scaling pinterest
Mohit Jain
 

What's hot (20)

The Complete MariaDB Server tutorial
The Complete MariaDB Server tutorialThe Complete MariaDB Server tutorial
The Complete MariaDB Server tutorial
 
MariaDB pres at LeMUG
MariaDB pres at LeMUGMariaDB pres at LeMUG
MariaDB pres at LeMUG
 
MariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete Tutorial
 
Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?
 
Netezza online training at GoLogica
Netezza online training at GoLogicaNetezza online training at GoLogica
Netezza online training at GoLogica
 
Plmce2012 scaling pinterest
Plmce2012 scaling pinterestPlmce2012 scaling pinterest
Plmce2012 scaling pinterest
 
Lessons from database failures
Lessons from database failuresLessons from database failures
Lessons from database failures
 
MariaDB: in-depth (hands on training in Seoul)
MariaDB: in-depth (hands on training in Seoul)MariaDB: in-depth (hands on training in Seoul)
MariaDB: in-depth (hands on training in Seoul)
 
The MySQL Server ecosystem in 2016
The MySQL Server ecosystem in 2016The MySQL Server ecosystem in 2016
The MySQL Server ecosystem in 2016
 
When is Myrocks good? 2020 Webinar Series
When is Myrocks good? 2020 Webinar SeriesWhen is Myrocks good? 2020 Webinar Series
When is Myrocks good? 2020 Webinar Series
 
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live LondonMariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
 
SQL vs NoSQL: Big Data Adoption & Success in the Enterprise
SQL vs NoSQL: Big Data Adoption & Success in the EnterpriseSQL vs NoSQL: Big Data Adoption & Success in the Enterprise
SQL vs NoSQL: Big Data Adoption & Success in the Enterprise
 
Orchestrating MySQL
Orchestrating MySQLOrchestrating MySQL
Orchestrating MySQL
 
Cool MariaDB Plugins
Cool MariaDB Plugins Cool MariaDB Plugins
Cool MariaDB Plugins
 
Exploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12cExploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12c
 
Why MariaDB?
Why MariaDB?Why MariaDB?
Why MariaDB?
 
My first moments with MongoDB
My first moments with MongoDBMy first moments with MongoDB
My first moments with MongoDB
 
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document StoreConnector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
 
Best practices for MySQL/MariaDB Server/Percona Server High Availability
Best practices for MySQL/MariaDB Server/Percona Server High AvailabilityBest practices for MySQL/MariaDB Server/Percona Server High Availability
Best practices for MySQL/MariaDB Server/Percona Server High Availability
 
PostgreSQL as an Alternative to MSSQL
PostgreSQL as an Alternative to MSSQLPostgreSQL as an Alternative to MSSQL
PostgreSQL as an Alternative to MSSQL
 

Similar to Is the database a solved problem?

Similar to Is the database a solved problem? (20)

A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
 
Revision
RevisionRevision
Revision
 
Webinar 2017. Supercharge your analytics with ClickHouse. Alexander Zaitsev
Webinar 2017. Supercharge your analytics with ClickHouse. Alexander ZaitsevWebinar 2017. Supercharge your analytics with ClickHouse. Alexander Zaitsev
Webinar 2017. Supercharge your analytics with ClickHouse. Alexander Zaitsev
 
NoSQL on the move
NoSQL on the moveNoSQL on the move
NoSQL on the move
 
Maria db 10 and the mariadb foundation(colin)
Maria db 10 and the mariadb foundation(colin)Maria db 10 and the mariadb foundation(colin)
Maria db 10 and the mariadb foundation(colin)
 
NoSQL in the context of Social Web
NoSQL in the context of Social WebNoSQL in the context of Social Web
NoSQL in the context of Social Web
 
The Complete MariaDB Server Tutorial - Percona Live 2015
The Complete MariaDB Server Tutorial - Percona Live 2015The Complete MariaDB Server Tutorial - Percona Live 2015
The Complete MariaDB Server Tutorial - Percona Live 2015
 
The MySQL Server ecosystem in 2016
The MySQL Server ecosystem in 2016The MySQL Server ecosystem in 2016
The MySQL Server ecosystem in 2016
 
The Evolution of Open Source Databases
The Evolution of Open Source DatabasesThe Evolution of Open Source Databases
The Evolution of Open Source Databases
 
Big Data Developers Moscow Meetup 1 - sql on hadoop
Big Data Developers Moscow Meetup 1  - sql on hadoopBig Data Developers Moscow Meetup 1  - sql on hadoop
Big Data Developers Moscow Meetup 1 - sql on hadoop
 
Databases in the hosted cloud
Databases in the hosted cloud Databases in the hosted cloud
Databases in the hosted cloud
 
In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and me
 
SQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The MoveSQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The Move
 
Object Relational Database Management System
Object Relational Database Management SystemObject Relational Database Management System
Object Relational Database Management System
 
Denodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me AnythingDenodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me Anything
 
Non-Relational Databases at ACCU2011
Non-Relational Databases at ACCU2011Non-Relational Databases at ACCU2011
Non-Relational Databases at ACCU2011
 
Database Technologies
Database TechnologiesDatabase Technologies
Database Technologies
 
Where to save my data, for devs!
Where to save my data, for devs!Where to save my data, for devs!
Where to save my data, for devs!
 
Michael stack -the state of apache h base
Michael stack -the state of apache h baseMichael stack -the state of apache h base
Michael stack -the state of apache h base
 
High-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and JavaHigh-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and Java
 

More from Kenneth Geisshirt

Naturvidenskabsfestival 2012
Naturvidenskabsfestival 2012Naturvidenskabsfestival 2012
Naturvidenskabsfestival 2012
Kenneth Geisshirt
 
JavaScript/Emacs integration
JavaScript/Emacs integrationJavaScript/Emacs integration
JavaScript/Emacs integration
Kenneth Geisshirt
 

More from Kenneth Geisshirt (19)

Building parsers in JavaScript
Building parsers in JavaScriptBuilding parsers in JavaScript
Building parsers in JavaScript
 
Open Source in Real Life
Open Source in Real LifeOpen Source in Real Life
Open Source in Real Life
 
Building mobile apps with Realm for React Native
Building mobile apps with Realm for React NativeBuilding mobile apps with Realm for React Native
Building mobile apps with Realm for React Native
 
micro:bit and JavaScript
micro:bit and JavaScriptmicro:bit and JavaScript
micro:bit and JavaScript
 
Tales from the dark side: developing SDKs at scale
Tales from the dark side: developing SDKs at scaleTales from the dark side: developing SDKs at scale
Tales from the dark side: developing SDKs at scale
 
Android things
Android thingsAndroid things
Android things
 
Node.js extensions in C++
Node.js extensions in C++Node.js extensions in C++
Node.js extensions in C++
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
Tips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native codeTips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native code
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
Extending Node.js using C++
Extending Node.js using C++Extending Node.js using C++
Extending Node.js using C++
 
Building High Performance Android Applications in Java and C++
Building High Performance Android Applications in Java and C++Building High Performance Android Applications in Java and C++
Building High Performance Android Applications in Java and C++
 
Sociale netværk
Sociale netværkSociale netværk
Sociale netværk
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
Naturvidenskabsfestival 2012
Naturvidenskabsfestival 2012Naturvidenskabsfestival 2012
Naturvidenskabsfestival 2012
 
Hadoop - the data scientist's toolbox
Hadoop - the data scientist's toolboxHadoop - the data scientist's toolbox
Hadoop - the data scientist's toolbox
 
JavaScript/Emacs integration
JavaScript/Emacs integrationJavaScript/Emacs integration
JavaScript/Emacs integration
 
Introduction to JavaScript for Modern Software Development
Introduction to JavaScript for Modern Software DevelopmentIntroduction to JavaScript for Modern Software Development
Introduction to JavaScript for Modern Software Development
 
Kendthed og vigtighed
Kendthed og vigtighedKendthed og vigtighed
Kendthed og vigtighed
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

Is the database a solved problem?

  • 2. Disclaimer I work for Realm Realm is a database vendor I am a little biased
  • 3. Agenda • What is a database? • The history of databases • Relational databases, the NoSQL revolution • Mobile platforms • Mobile database solutions
  • 4. What is a database? • According to Wikipedia: A database is an organized collection of data. • Common components • data definition (create the structure/schema) • insert, update, delete data • query/retrieve data • Databases are often ACID compliant
  • 5. The history • First commercial database: IDS (1964) - a network database • Relational databases were developed in 1970s • DB2, Oracle, Ingress • Moving to the desktops in 1980s: dBASE were popular • DotCom era - or the MySQL era (1995) • ca. 2009: NoSQL movement
  • 6. The Victory of The Relational Database • Relational database model dominates the world • DB2 is heavily used by banks • Oracle is found in large enterprises • MySQL powers almost every web sites • SQLite is an embedded database: initial release in 2000
  • 7. SQL • Structured Query Language is by all relational databases • Components • Data definition (creating tables, …) • Data manipulation (inserting rows, …) • Querying INSERT INTO Person VALUES('Kenneth', 46) SELECT * FROM Person WHERE name = 'Kenneth'
  • 8. Object-Relation Mappers • Relational modelling requires normalisation • Object modelling is often a more direct • ORMs try to bridge the gap Invoice Item Number Price CPU 1 2000 RAM 4 4000 Disk 2 6000 Z Corporation 64 Hard Drive 1024 Machineville Line Invoice InvoiceID LineID Line Relationalmodel Objectmodel
  • 9. End of The Relational Era • Relational databases don’t scale well • popular web sites are very popular (think Twitter) • Schemas are not flexible • normalisation leads to complex architecture • ACID is not always a requirement
  • 10.
  • 11. Mobile platforms • Nokia N95 (2007) • dual-core @ 322 MHz, 160 MB ram • OnePlus One (2014) • quad-core @ 2.5 GHz, 3 GB ram, 64 GB storage • iOS and Android dominate the market • UNIX like kernels + libraries • Java (version 6 + some version 7), Objective C, and Swift
  • 12. Mobile databases • Three types of mobile data solutions: • Real databases • Data storages using SQLite as store engine • Object Relation Mappers (ORMs) on top of SQLite
  • 13. • Library providing a SQL interface to data • Most of SQL-92, simplified type system • Preinstalled on iOS, Android, Windows Phone 8, Blackberry 10 • 1.8+ billion active devices1 • Liberal license: public domain 1http://www.engadget.com/2014/06/25/google-io-2014-by-the-numbers/
  • 14. SQLite on Mobile iOS • Rarely used directly • Popular ORMs: Core Data, Magical Record, FMDB Android • The Java community is highly object oriented • Can be used directly • Popular ORMs: ORMLite, GreenDAO, SugarORM, DBFlow
  • 15. Core Data • Apple’s object graph and persistent framework • Supported under iOS and OS X • Many storage formats: XML, binary files, SQLite • Highly integrated into Xcode • Part of the iOS/Cocoa SDKs
  • 16. Magical Record • Inspired by Fowler’s active record pattern and Ruby on Rails’ Active Record • Build on-top of Core Data • Managed Object • https://github.com/magicalpanda/MagicalRecord
  • 17. FMDB • Objective C wrapper around SQLite • Major classes • FMDatabase - “connection” to SQLite database • FMDatabaseQueue - queue of queries and operations • FMResultSet - results from a query • License: MIT • http://ccgus.github.io/fmdb/
  • 18. FMDB - query FMDatabase *db = [FMDatabase databaseWithPath:@“/tmp/tmp.db”]; [db open]; FMResultSet *s = [db executeQuery:@"SELECT * FROM myTable”]; while ([s next]) { // … } [db close];
  • 19. YAP • Key/value store • Supports iOS (and OS X) • SQLite is used as storage engine • License: BSD • https://github.com/yapstudios/YapDatabase
  • 20. LevelDB • Embedded key/value store (in C++) • License: BSD • https://github.com/google/leveldb • iOS: https://github.com/matehat/Objective-LevelDB • Android: SnappyDB uses LevelDB + additional compression
  • 21. Realm • Realm is an object store • Data model = classes (inheriting from a Realm object) • Supports iOS, Android and OS X • Core is written in C++ and highly portable • Custom bindings to give “native touch” • License: Apache 2.0 (binding) + closed (core)
  • 22. Realm - iOS - store RLMRealm *realm = [RLMRealm defaultRealm]; [realm beginWriteTransaction]; Person *person = [[Person alloc] init]; person.name = @"Kenneth"; person.age = 46; [realm addObject:person]; [realm commitWriteTransaction];
  • 23. Realm - iOS - query RLMResults *persons = [Person objectsWhere:@"name = ‘Kenneth'"]; for (Person *person in persons) { NSLog(@"Age:", person.age); }
  • 24. Realm - Android - store Realm realm = Realm.getInstance(context); realm.beginTransaction(); Person person = realm.createObject(Person.class); person.setName(“Kenneth”); person.setAge(46); realm.commitTransaction();
  • 25. Realm - Android - query RealmResults<Person> persons = realm.where(Person.class) .equalTo("name", “Kenneth").findAll(); for (Person person : persons) { Log.d("REALM", "Age: " + person.getAge()); }
  • 26. CouchBase Mobile • Three components: • CouchBase Lite: embedded database • CouchBase Server: backend storage • CouchBase Sync: synchronization • Supports iOS, Android and desktop/server platforms • Local storage is based on SQLite • http://www.couchbase.com/nosql-databases/couchbase-mobile
  • 27. CouchBase - iOS CBLManager *manager = CBLManager sharedInstance]; CBLDatabase *database = [manager databaseNamed: dbname error: &error]; NSDictiorary *person = @{ @"name": @"Kenneth", @"age": @46 }; CBLDocument* doc = [database createDocument]; NSString *docID = doc.documentID; CBLRevision *newRevision = [doc putProperties: myDictionary error: &error];
  • 28. CouchBase - Android Manager manager = new Manager(new AndroidContext(this), Manager.DEFAULT_OPTIONS); Database database = manager.getDatabase("database"); Map<String, Object> docContent = new HashMap<String, Object>(); docContent.put("name", "Kenneth"); docContent.put("age", 46); Document document = database.createDocument(); document.putProperties(docContent); String docID = document.getId();
  • 29. Parse • Cloud database (and local storage) • Supports iOS, Android, and Windows Phone (and desktop/server platforms) • Store and retrieve objects in the background • Payment = requests per second • https://www.parse.com
  • 30. Parse - iOS - store PFObject *person = [PFObject objectWithClassName:@“Person”]; [person setObject:@“Kenneth” forKey:@“name”]; [person setObject:@“46” forKey:@“age”]; [person saveInBackground];
  • 31. Parse - iOS - query PFQuery *query = [PFQuery queryWithClassName:@“Person”]; [query whereKey:@“name” equalTo:@“Kenneth”]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { for (PFObject *object in objects) { NSLog(@“%@“, object[@“age”]); } ];
  • 32. Parse - Android - store ParseObject person = new ParseObject(“Person”); person.put(“name”, “Kenneth”); person.put(“age”, 46); person.saveInBackground();
  • 33. Parse - Android - query ParseQuery<ParseObject> query = ParseQuery.getQuery(“Person”); query.whereEqualTo(“name”, “Kenneth”); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> list, ParseException e) { for (int i=0; i<list.size(); i++) { Log.d(“age”, “Age: “ + list.get(i).getInt(“age”)); } } });
  • 34. Hot topics • Synchronisation between devices and back-end • Often ReST services are used (with JSON) • Parse and CouchBase Lite try to solve it • Reactive programming • RxJava (for Android) • ReactiveCocoa (iOS)
  • 35. The database is not a solved problemDan Strange, http://bit.ly/1QqQfEe