JSONiq - The SQL of NoSQL

38
JSONiq - The SQL of NoSQL William Candillon { [email protected] } msec

description

Since a couple of years, the NoSQL movement has developed a variety of open-source document stores. They are focused on high availability, horizontal scalability, and are designed to run on commodity hardware. These products have gained great traction in the industry to store large amounts of flexible data. Arguably, the next step for the NoSQL community is on harnessing flexible data processing. The aim of this presentation is to introduce JSONiq: the SQL of NoSQL.

Transcript of JSONiq - The SQL of NoSQL

Page 1: JSONiq - The SQL of NoSQL

JSONiq - The SQL of NoSQLWilliam Candillon {[email protected]}

msec

Page 2: JSONiq - The SQL of NoSQL

Two Drivers

Page 3: JSONiq - The SQL of NoSQL

Scalability

Page 4: JSONiq - The SQL of NoSQL

Flexible Data

Page 5: JSONiq - The SQL of NoSQL

NoSQL Checklist 28

Page 6: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔

NoSQL Checklist 28

Page 7: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔Sharding ✔

NoSQL Checklist 28

Page 8: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔Sharding ✔Available as a Service ✔

NoSQL Checklist 28

Page 9: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔Sharding ✔Available as a Service ✔Standardized Query Language

NoSQL Checklist 28

Page 10: JSONiq - The SQL of NoSQL

Standardization (1) 28

Page 11: JSONiq - The SQL of NoSQL

Standardization (2) 28

Page 12: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔Sharding ✔Available as a Service ✔Standardized Query Language X

NoSQL Checklist 28

Page 13: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔Sharding ✔Available as a Service ✔Standardized Query Language X

Modern Query Processing

NoSQL Checklist 28

Page 14: JSONiq - The SQL of NoSQL

Modern Query Processing (2) 28

Page 15: JSONiq - The SQL of NoSQL

Modern Query Processing (1) 28

Page 16: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔Sharding ✔Available as a Service ✔Standardized Query Language X

Modern Query Processing X

NoSQL Checklist 28

Page 17: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔Sharding ✔Available as a Service ✔Standardized Query Language X

Modern Query Processing X

Rich Data Model

NoSQL Checklist 28

Page 18: JSONiq - The SQL of NoSQL

Rich Data Model (1) 28

Page 19: JSONiq - The SQL of NoSQL

Rich Data Model (2) 28

Page 20: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔Sharding ✔Available as a Service ✔Standardized Query Language X

Modern Query Processing X

Rich Data Model X

NoSQL Checklist 28

Page 21: JSONiq - The SQL of NoSQL

Document Stores

High Availability ✔Sharding ✔Available as a Service ✔Standardized Query Language X

Modern Query Processing X

Rich Data Model X

ScalabilityFlexible D

ataNoSQL Checklist 28

Page 22: JSONiq - The SQL of NoSQL

The SQL of NoSQL

Page 23: JSONiq - The SQL of NoSQL

JSONiq (1) 28

Extension of XQuery, a mature W3C standard, with native JSON support

Contributors: 28msec, Oracle, EMC

Declarative JSON Query LanguageFully Composable

Page 24: JSONiq - The SQL of NoSQL

JSONiq (2) 28

Updates, Indexes, Search, Transform & Filter, Join, Group, and more

Open Source Implementation: Zorba

Drivers: MongoDB, CouchDB, AmazonDB, SQLite, Oracle NoSQL

Page 25: JSONiq - The SQL of NoSQL

{ "question_id" : 42, "title" : "NoSQL: Help me to choose", "tags" : [ "mongodb", "couchdb" ], "answered" : true, }

Page 26: JSONiq - The SQL of NoSQL

let $question :={ "question_id" : 42, "title" : "NoSQL: Help me to choose", "tags" : [ "mongodb", "couchdb" ], "answered" : true, }return $question("title")

Page 27: JSONiq - The SQL of NoSQL

for $answers in mongo:find("answers")group by $id := $answers("question_id")order by count($answers) descendinglet $faq := mongo:find("faq")return <h1>{ $faq[.("id") eq $id]("title") }</h1>

<h1>NoSQL: Help me to Choose</h1><h1>What NoSQL solutions for .NET?</h1><h1>The Next-gen Databases</h1>...

Page 28: JSONiq - The SQL of NoSQL

for $question in mongo:find("faq")let $user := $question("owner")group by $user := $user("user_id")return { "user" : $user[last()]("display_name"), "count" : count($question)}

{ "user": "jbellis", "count": 6 }{ "user": "user1557698", "count": 5 }{ "user": "nawroth", "count": 5 }...

Page 29: JSONiq - The SQL of NoSQL

max( for tumbling window $answers in mongo:find("answers") start $start when true only end $end next $next when $next("date") - $end("date") gt xs:dayTimeDuration("P1D") return $end("date") - $start("date"))

{ "user": "jbellis", "streak": 2 }{ "user": "user1557698", "streak": 1 }{ "user": "nawroth", "streak": 1 }...

Page 30: JSONiq - The SQL of NoSQL

"Luke, I am your father"contains text "dad"

false

Page 31: JSONiq - The SQL of NoSQL

"Luke, I am your father"contains text "dad"using thesaurus default

true

Page 32: JSONiq - The SQL of NoSQL

let $s := "These are not the droids you are looking for"let $tokens := ft:tokenize-string($s)for $token in $tokenswhere not(ft:is-stop-word($token))return ft:stem($token)

droid look...

Page 33: JSONiq - The SQL of NoSQL

MongoDB Driver

Runtime CollectionsXDM Indexes

MongoS CollectionsBSON Indexes

Zorba

MongoDB

28

Page 34: JSONiq - The SQL of NoSQL

28.io

• Seamless JSONiq Integration into MongoDB

• Automatic Scale out of the Query Processing

Runtime CollectionsXDM Indexes

MongoS CollectionsBSON Indexes

Zorba

MongoDB

28

Page 35: JSONiq - The SQL of NoSQL

28.io 28

Page 36: JSONiq - The SQL of NoSQL

Put the Pressure back to the Query Language

Page 37: JSONiq - The SQL of NoSQL

Take Away

• JSONiq.org - The SQL of NoSQL

• Open Source Implementation: Zorba

• Next Stop: Automatic Index Detection Query Parallelization

• Hosting: 28.io

• Demo: http://28.io/mongodb

28

Page 38: JSONiq - The SQL of NoSQL

Thank You!Questions?

msec