SlideShare a Scribd company logo
SQL for JSON:
Rich, Declarative Querying for NoSQL
Databases and Applications
Gerald Sangudi | @sangudi | Chief Architect | Couchbase
Keshav Murthy| @rkeshavmurthy | Director | Couchbase
Team @N1QL
©2015 Couchbase Inc. 2
Agenda
Why NoSQL?
 JSON Data Modeling
 SQL for JSON
 Java APIs
 Ecosystem
©2015 Couchbase Inc. 3
Major Enterprises Across Industries are Adopting NoSQL
3
CommunicationsTechnology
Travel & Hospitality Media &
Entertainment
E-Commerce &
Digital Advertising
Retail & Apparel
Games & GamingFinance &
Business Services
Why NoSQL?
©2015 Couchbase Inc. 5
Why NoSQL?
Agility
Scalability
Performance
Availability
©2015 Couchbase Inc. 6
Why NoSQL? Agility
 Schema flexibility
 Easier management of change
 In the business requirements
 In the structure of the data
 Change is inevitable
©2015 Couchbase Inc. 7
Why NoSQL? Scalability
 Elastic scaling
 Size your cluster for today
 Scale out on demand
 Cost effective scaling
 Commodity hardware
 On premise or on cloud
 Scale OUT instead of Scale UP
©2015 Couchbase Inc. 8
Why NoSQL? Performance
 NoSQL systems are optimized for specific access patterns
 Low response time for web & mobile user experience
 Millisecond latency
 Consistently high throughput to handle growth
©2015 Couchbase Inc. 9
Why NoSQL? Availability
 Built-in replication and fail-over
 No application downtime when hardware fails
 Online maintenance & upgrade
 No application downtime
©2015 Couchbase Inc. 10
NoSQL Landscape
Document
• Couchbase
• MongoDB
• DynamoDB
• DocumentDB
Graph
• OrientDB
• Neo4J
• DEX
• GraphBase
Key-Value
• Couchbase
• Riak
• BerkeleyDB
• Redis
• … Wide Column
• Hbase
• Cassandra
• Hypertable
JSON Data Modeling
©2015 Couchbase Inc. 12
Properties of Real-World Data
 Rich structure
– Attributes, Sub-structure
 Relationships
– To other data
 Value evolution
– Data is updated
 Structure evolution
– Data is reshaped
Customer
Name
DOB
Billing
Connections
Purchases
©2015 Couchbase Inc. 13
Modeling Data in RelationalWorld
Billing
ConnectionsPurchases
Contacts
Customer
 Rich structure
 Normalize & JOIN Queries
 Relationships
 JOINS and Constraints
 Value evolution
 INSERT, UPDATE, DELETE
 Structure evolution
 ALTERTABLE
 Application Downtime
 Application Migration
 ApplicationVersioning
©2015 Couchbase Inc. 14
Using JSON For RealWorld Data
CustomerID Name DOB
CBL2015 Jane Smith 1990-01-30
Table: Customer
{
"Name" : "Jane Smith",
"DOB" : "1990-01-30”
}
Customer DocumentKey: CBL2015
 The primary (CustomerID) becomes the
DocumentKey
 Column name-Column value become
KEY-VALUE pair.
{
"Name" : {
"fname": "Jane ",
"lname": "Smith”
}
"DOB" : "1990-01-30”
}
OR
©2015 Couchbase Inc. 15
Using JSON to Store Data
CustomerID Name DOB
CBL2015 Jane Smith 1990-01-30
Table: Customer
{
"Name" : "Jane Smith",
"DOB" : "1990-01-30",
"Billing" : [
{
"type" : "visa",
"cardnum" : "5827-2842-2847-3909",
"expiry" : "2019-03"
}
]
}
Customer DocumentKey: CBL2015
CustomerID Type Cardnum Expiry
CBL2015 visa 5827… 2019-03
Table: Billing
 Rich Structure & Relationships
– Billing information is stored as a sub-document
– There could be more than a single credit card. So, use an array.
©2015 Couchbase Inc. 16
Using JSON to Store Data
CustomerID Name DOB
CBL2015 Jane Smith 1990-01-30
Table: Customer
{
"Name" : "Jane Smith",
"DOB" : "1990-01-30",
"Billing" : [
{
"type" : "visa",
"cardnum" : "5827-2842-2847-3909",
"expiry" : "2019-03"
},
{
"type" : "master",
"cardnum" : "6274-2542-5847-3949",
"expiry" : "2018-12"
}
]
}
Customer DocumentKey: CBL2015
CustomerID Type Cardnum Expiry
CBL2015 visa 5827… 2019-03
CBL2015 master 6274… 2018-12
Table: Billing
 Value evolution
 Simply add additional array element or
update a value.
©2015 Couchbase Inc. 17
Using JSON to Store Data
CustomerID ConnId Name
CBL2015 XYZ987 Joe Smith
CBL2015 SKR007 Sam Smith
Table: Connections
{
"Name" : "Jane Smith",
"DOB" : "1990-01-30",
"Billing" : [
{
"type" : "visa",
"cardnum" : "5827-2842-2847-3909",
"expiry" : "2019-03"
},
{
"type" : "master",
"cardnum" : "6274-2542-5847-3949",
"expiry" : "2018-12"
}
],
"Connections" : [
{
"ConnId" : "XYZ987",
"Name" : "Joe Smith"
},
{
"ConnId" : ”SKR007",
"Name" : ”Sam Smith"
}
}
Customer DocumentKey: CBL2015
 Structure evolution
 Simply add new key-value pairs
 No downtime to add new KV pairs
 Applications can validate data
 Structure evolution over time.
 Relations via Reference
©2015 Couchbase Inc. 18
Using JSON to Store Data
{
"Name" : "Jane Smith",
"DOB" : "1990-01-30",
"Billing" : [
{
"type" : "visa",
"cardnum" : "5827-2842-2847-3909",
"expiry" : "2019-03"
},
{
"type" : "master",
"cardnum" : "6274-2842-2847-3909",
"expiry" : "2019-03"
}
],
"Connections" : [
{
"CustId" : "XYZ987",
"Name" : "Joe Smith"
},
{
"CustId" : "PQR823",
"Name" : "Dylan Smith"
}
{
"CustId" : "PQR823",
"Name" : "Dylan Smith"
}
],
"Purchases" : [
{ "id":12, item: "mac", "amt": 2823.52 }
{ "id":19, item: "ipad2", "amt": 623.52 }
]
}
DocumentKey: CBL2015
CustomerID Name DOB
CBL2015 Jane Smith 1990-01-30
Customer
ID
Type Cardnum Expiry
CBL2015 visa 5827… 2019-03
CBL2015 maste
r
6274… 2018-12
CustomerID ConnId Name
CBL2015 XYZ987 Joe Smith
CBL2015 SKR007 Sam Smith
CustomerID item amt
CBL2015 mac 2823.52
CBL2015 ipad2 623.52
CustomerID ConnId Name
CBL2015 XYZ987 Joe Smith
CBL2015 SKR007 Sam
Smith
Contacts
Customer
Billing
ConnectionsPurchases
©2015 Couchbase Inc. 19
Models for Representing Data
Data Concern Relational Model
JSON Document Model
(NoSQL)
Rich Structure
 Multiple flat tables
 Constant assembly / disassembly
 Documents
 No assembly required!
Relationships
 Represented
 Queried (SQL)
 Represented
 Queried? Not until now…
Value Evolution  Data can be updated  Data can be updated
Structure Evolution
 Uniform and rigid
 Manual change (disruptive)
 Flexible
 Dynamic change
SQL For JSON
©2015 Couchbase Inc. 21
Why SQL for JSON
 NoSQL systems provide specializedAPIs
 Key-Value get and set
 Script based query APIs
 Limited declarative query
 Richer query is needed
©2015 Couchbase Inc. 22
Client Side Querying is Inadequate
Find High-Value Customers with Orders > $10000
Query customer
objects from
database
• Complex codes and logic
• Inefficient processing on client side
For each customer
object
Find all the order
objects for the
customer
Calculate the total
amount for each
order
Sum up the grand
total amount for all
orders
If grand total
amount > $10000,
Extract customer
data
Add customer to
the high-value
customer list
Sort the high-value
customer list
LOOPING OVER MILLIONS OF CUSTOMERS IN APPLICATION!!!
©2015 Couchbase Inc. 23
Goal of Query for JSON
Give developers and enterprises an expressive,
powerful, and complete language for querying,
transforming, and manipulating JSON data.
©2015 Couchbase Inc. 25
Industry Is Choosing SQL to Query JSON
 JSON support in SQL
– IBM Informix
– Oracle
– PostgreSQL
– MySQL
 Microsoft: SQL for DocumentDB
 UC San Diego: SQL++
 Couchbase: N1QL
©2015 Couchbase Inc. 26
ResultSet
©2015 Couchbase Inc. 27
{
"Name" : "Jane Smith",
"DOB" : "1990-01-30",
"Billing" : [
{
"type" : "visa",
"cardnum" : "5827-2842-2847-3909",
"expiry" : "2019-03"
},
{
"type" : "master",
"cardnum" : "6274-2842-2847-3909",
"expiry" : "2019-03"
}
],
"Connections" : [
{
"CustId" : "XYZ987",
"Name" : "Joe Smith"
},
{
"CustId" : "PQR823",
"Name" : "Dylan Smith"
}
{
"CustId" : "PQR823",
"Name" : "Dylan Smith"
}
],
"Purchases" : [
{ "id":12, item: "mac", "amt": 2823.52 }
{ "id":19, item: "ipad2", "amt": 623.52 }
]
}
LoyaltyInfo ResultDocuments
Orders
CUSTOMER
©2015 Couchbase Inc. 28
N1QL examples
SELECT d.C_ZIP, SUM(ORDLINE.OL_QUANTITY) AS TOTALQTY
FROM CUSTOMER d
UNNEST ORDERS as CUSTORDERS
UNNEST CUSTORDERS.ORDER_LINE AS ORDLINE
WHERE d.C_STATE = ”NY”
GROUP BY d.C_ZIP
ORDER BY TOTALQTY DESC;
INSERT INTO CUSTOMER("PQR847", {"C_ID":4723, "Name":"Joe"});
UPDATE CUSTOMER c SET c.STATE=“CA”, c.C_ZIP = 94501
WHERE c.ID = 4723;
©2015 Couchbase Inc. 29
SELECT Statement
SELECT customers.id,
customers.NAME.lastname,
customers.NAME.firstname
Sum(orderline.amount)
FROM orders UNNEST orders.lineitems AS orderline
JOIN customers ON KEYS orders.custid
WHERE customers.state = 'NY'
GROUP BY customers.id,
customers.NAME.lastname
HAVING sum(orderline.amount) > 10000
ORDER BY sum(orderline.amount) DESC
• Dotted sub-document reference
• Names are CASE-SENSITIVE
• UNNEST to flatten the arrays
JOINS with Document KEY of
customers
©2015 Couchbase Inc. 30
Composable SELECT statement
SELECT *
FROM
( SELECT a, b, c
FROM us_cust
WHERE x = 1
ORDER BY x LIMIT 100 OFFSET 0
UNION ALL
SELECT a, b, c
FROM canada_cust
WHERE y = 2
ORDER BY x LIMIT 100 OFFSET 0) AS newtab
LEFT OUTER JOIN contacts
ON KEYS newtab.c.contactid
ORDER BY a, b, c
LIMIT 10 OFFSET 0
©2015 Couchbase Inc. 31
SELECT Statement Highlights
 Querying across relationships
– JOINs
– Subqueries
 Aggregation
– MIN, MAX
– SUM, COUNT, AVG,ARRAY_AGG [ DISTINCT ]
 Combining result sets using set operators
– UNION, UNIONALL, INTERSECT, EXCEPT
©2015 Couchbase Inc. 32
N1QL Query Operators [ 1 of 2 ]
 USE KEYS …
– Direct primary key lookup bypassing index scans
– Ideal for hash-distributed datastore
– Available in SELECT, UPDATE, DELETE
 JOIN … ON KEYS …
– Nested loop JOIN using key relationships
– Ideal for hash-distributed datastore
– Current implementation supports INNER and LEFT OUTER joins
©2015 Couchbase Inc. 33
N1QL Query Operators [ 2 of 2 ]
 NEST
– Special JOIN that embeds external child documents under their parent
– Ideal for JSON encapsulation
 UNNEST
– Flattening JOIN that surfaces nested objects as top-level documents
– Ideal for decomposing JSON hierarchies
JOIN, NEST, and UNNEST can be chained in any combination
©2015 Couchbase Inc. 34
N1QL Expressions for JSON
©2014 Couchbase, Inc. 34
Ranging over collections
• WHERE ANY c IN children SATISFIES c.age > 10 END
• WHERE EVERY r IN ratings SATISFIES r > 3 END
Mapping with filtering • ARRAY c.name FOR c IN children WHEN c.age > 10 END
Deep traversal, SET, and
UNSET
• WHERE ANY node WITHIN request SATISFIES node.type = “xyz” END
• UPDATE doc UNSET c.field1 FOR c WITHIN doc END
DynamicConstruction
• SELECT { “a”: expr1, “b”: expr2 } AS obj1, name FROM … // Dynamic object
• SELECT [ a, b ] FROM … // Dynamic array
Nested traversal • SELECT x.y.z, a[0] FROM a.b.c …
IS [ NOT ] MISSING • WHERE name IS MISSING
©2015 Couchbase Inc. 35
N1QL DataTypes from JSON
N1QL supports all JSON data types
 Numbers
 Strings
 Booleans
 Null
 Arrays
 Objects
©2015 Couchbase Inc. 36
N1QL DataType Handling
Non-JSON data types
– MISSING
– Binary
Data type handling
 Date functions for string and numeric encodings
 Total ordering across all data types
– Well defined semantics for ORDER BY and comparison operators
 Defined expression semantics for all input data types
– No type mismatch errors
©2015 Couchbase Inc. 37
Data Modification Statements
 UPDATE … SET … WHERE …
 DELETE FROM … WHERE …
 INSERT INTO … ( KEY,VALUE ) VALUES …
 INSERT INTO … ( KEY …,VALUE … ) SELECT …
 MERGE INTO … USING … ON …
WHEN [ NOT ] MATCHEDTHEN …
Note: Couchbase provides per-document atomicity.
©2015 Couchbase Inc. 38
Data Modification Statements
INSERT INTO ORDERS (KEY, VALUE)
VALUES ("1.ABC.X382", {"O_ID":482, "O_D_ID":3, "O_W_ID":4});
UPDATE ORDERS
SET O_CARRIER_ID = ”ABC987”
WHERE O_ID = 482 AND O_D_ID = 3 AND O_W_ID = 4
DELETE FROM NEW_ORDER
WHERE NO_D_ID = 291 AND
NO_W_ID = 3482 AND
NO_O_ID = 2483
JSON literals can be used in any
expression
©2015 Couchbase Inc. 39
Index Statements
 CREATE INDEX ON …
 DROP INDEX …
 EXPLAIN …
Highlights
 Functional indexes
– on any data expression
 Partial indexes
©2015 Couchbase Inc. 40
Index Overview: Secondary Index
 Secondary Index can be created on any
combination of attribute names.
 CREATE INDEX idx_cust_cardnum
customer(ccInfo.cardNumber, postalcode)
 Useful in speeding up the queries.
 Need to have matching indices with right key-
ordering
 (ccInfo.cardExpiry, postalCode)
 (type, state, lastName firstName)
"customer": {
"ccInfo": {
"cardExpiry": "2015-11-11",
"cardNumber”:"1212-232-1234",
"cardType": "americanexpress”
},
"customerId": "customer534",
"dateAdded": "2014-04-06",
"dateLastActive”:"2014-05-02”,
"emailAddress”:”iles@kertz.name",
"firstName": "Mckayla",
"lastName": "Brown",
"phoneNumber": "1-533-290-6403",
"postalCode": "92341",
"state": "VT",
"type": "customer"
}
Document key: “customer534”
©2015 Couchbase Inc. 41
Find High-Value Customers with Orders > $10000
SQL for JSON
API QUERY
VS.
Query customer
objects from
database
• Proven and
expressive query
language
• Leverage SQL
skills and
ecosystem
• Extended for
JSON
• Complex codes
and logic
• Inefficient
processing on
client side
For each customer
object
Find all the order
objects for the
customer
Calculate the total
amount for each
order
Sum up the grand
total amount for all
orders
If grand total
amount > $10000,
Extract customer
data
Add customer to
the high-value
customer list
Sort the high-value
customer list
SELECT Customers.ID, Customers.Name, SUM(OrderLine.Amount)
FROM Orders UNNEST Orders.LineItems AS OrderLine
JOIN Customers ON KEYS Orders.CustID
GROUP BY Customers.ID, Customers.Name
HAVING SUM(OrderLine.Amount) > 10000
ORDER BY SUM(OrderLine.Amount) DESC
LOOPING OVER MILLIONS OF CUSTOMERS IN APPLICATION!!!
©2015 Couchbase Inc. 42
Summary: SQL & N1QL
Query Features SQL N1QL
Statements
 SELECT, INSERT, UPDATE, DELETE,
MERGE
 SELECT, INSERT, UPDATE, DELETE,
MERGE
Query Operations
 Select, Join, Project, Subqueries
 Strict Schema
 StrictType checking
 Select, Join, Project, Subqueries
 Nest & Unnest
 Look Ma! NoType Mismatch Errors!
 JSON keys act as columns
Schema  Predetermined Columns
 Fully addressable JSON
 Flexible document structure
DataTypes
 SQL Data types
 Conversion Functions
 JSON Data types
 Conversion Functions
Query Processing
 INPUT: Sets ofTuples
 OUPUT: Set ofTuples
 INPUT: Sets of JSON
 OUTPUT: Set of JSON
Java APIs
©2015 Couchbase Inc. 44
Java APIs
Standard JDBC driver (JDBC 4.0 and 4.1)
– Also, standard ODBC Driver
JDBC/JSON driver
–Extends JDBC for JSON
SDKs with Custom Query APIs
©2015 Couchbase Inc. 45
JDBC Driver
– JDBC 4.0 and 4.1
– Build an application which
can query using SQL or
N1QL
– Allow easy access to NoSQL
data from BI and ETL tools,
as well as your own
applications
JDBC Interface
©2015 Couchbase Inc. 46
Conversion between ANSI SQL and N1QL/JSON
Simba Couchbase JDBC Driver
 Allows users to infer or define
schemas on schema-less JSON data
 Converts JSON data to relational
data
 Based on JDBC 4.0 and 4.1 Standard
 Full 64-bit and 32-bit support
 Full SQL & N1QL support
 Comprehensive unicode support
JDBC Driver
JDBCInterface
DriverImplementation
SQL-92 N1QL
©2015 Couchbase Inc. 47
import java.sql.*;
import java.util.*;
public class Demo {
public static void main(String[] args) {
String url = "jdbc:couchbase://localhost:8093";
try {
Connection conn = DriverManager.getConnection(url);
try {
System.out.println("Connection successful.");
} finally { conn.close(); }
} catch (SQLException e) { e.printStackTrace(); } }
}
JDBC: Connecting
©2015 Couchbase Inc. 48
private static void doQuery(Connection conn) {
try {
String query = "select SELECT d.C_ZIP, "
+ "SUM(ORDLINE.OL_QUANTITY) AS TOTALQTY "
+ "FROM CUSTOMER d "
+ "GROUP BY d.C_ZIP ";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
}
catch (SQLException e) {
System.out.println("Error: " +
e.getLocalizedMessage());
}
}
JDBC: Executing Queries
©2015 Couchbase Inc. 49
Can change the driver to execute in N1QL mode by appending the following to the
connection URL:
;UseN1QLMode=1
Try the following N1QL query:
SELECT beer.name as beer_name, beer.abv, brewery.name as
brewery_name FROM `beer-sample` beer JOIN `beer-sample`
brewery ON KEYS [ beer.brewery_id ] WHERE beer.abv > 5 and
beer.style != "Lager" and beer.type = "beer" and
brewery.type = "brewery" ORDER BY beer.abv DESC LIMIT 5;
JDBC: Executing in N1QL Mode
©2015 Couchbase Inc. 50
Java JSR-374
 https://www.jcp.org/en/jsr/detail?id=374
This JSR is to provide an update for the Java API for JSON Processing Specification (JSON-P)
There are 3 goals for this JSR.
• Support for JSON Pointer and JSON Patch
• Add editing/transformation operations to JSON object model
• Update the API to work with Java SE 8
 JDBC will need to add enhanced JSON support.
– Couchbase has engaged with JDBC Committee
©2015 Couchbase Inc. 51
SDKs with Custom Query APIs
// raw string query
N1qlQueryResult queryResult =
bucket.query(N1qlQuery.simple("SELECT * FROM beer-sample LIMIT 10"));
// using the DSL
N1qlQueryResult query = bucket.query(select("*").from("beer-sample").limit(10));
bucket
.query(N1qlQuery.simple(select("*").from(i("beer-sample")).limit(10)))
.flatMap(AsyncN1qlQueryResult::rows)
.toBlocking()
.forEach(row -> System.out.println(row.value()));
• Fluent APIs for N1QL
• Use Domain Specific Language extensions
• Works well with query builders to provide features like auto completion
• Provides help with complex expressions like CASE,ANY, EVERY, etc.
• Supports parameter Passing
• Supports querying asynchronously
Ecosystem
©2015 Couchbase Inc. 53
Ecosystem Integration
©2015 Couchbase Inc. 54
Try SQL for JSON
N1QL is available in Couchbase 4.0
–http://query.couchbase.com
–Online Interactive Tutorial
Ask us questions
– Couchbase forums, Stack Overflow, @N1QL
Thank you
Q & A
Gerald Sangudi | @sangudi | Chief Architect | Couchbase
Keshav Murthy| @rkeshavmurthy | Director | Couchbase
@N1QL | query.couchbase.com

More Related Content

What's hot

MongoDB company and case studies - john hong
MongoDB company and case studies - john hong MongoDB company and case studies - john hong
MongoDB company and case studies - john hong
Ha-Yang(White) Moon
 
Data Democratization at Nubank
 Data Democratization at Nubank Data Democratization at Nubank
Data Democratization at Nubank
Databricks
 
A Journey to a Serverless Business Intelligence, Machine Learning and Big Dat...
A Journey to a Serverless Business Intelligence, Machine Learning and Big Dat...A Journey to a Serverless Business Intelligence, Machine Learning and Big Dat...
A Journey to a Serverless Business Intelligence, Machine Learning and Big Dat...
DataWorks Summit
 
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
Guido Schmutz
 
The State of Streaming Analytics: The Need for Speed and Scale
The State of Streaming Analytics: The Need for Speed and ScaleThe State of Streaming Analytics: The Need for Speed and Scale
The State of Streaming Analytics: The Need for Speed and Scale
VoltDB
 
Extreme Analytics @ eBay
Extreme Analytics @ eBayExtreme Analytics @ eBay
Extreme Analytics @ eBay
DataWorks Summit/Hadoop Summit
 
The Scout24 Data Platform (A Technical Deep Dive)
The Scout24 Data Platform (A Technical Deep Dive)The Scout24 Data Platform (A Technical Deep Dive)
The Scout24 Data Platform (A Technical Deep Dive)
RaffaelDzikowski
 
50 Shades of Data - Dutch Oracle Architects Platform (February 2018)
50 Shades of Data - Dutch Oracle Architects Platform (February 2018)50 Shades of Data - Dutch Oracle Architects Platform (February 2018)
50 Shades of Data - Dutch Oracle Architects Platform (February 2018)
Lucas Jellema
 
Data Beats Emotions – How DATEV Generates Business Value with Data-driven Dec...
Data Beats Emotions – How DATEV Generates Business Value with Data-driven Dec...Data Beats Emotions – How DATEV Generates Business Value with Data-driven Dec...
Data Beats Emotions – How DATEV Generates Business Value with Data-driven Dec...
DataWorks Summit
 
Mastering MapReduce: MapReduce for Big Data Management and Analysis
Mastering MapReduce: MapReduce for Big Data Management and AnalysisMastering MapReduce: MapReduce for Big Data Management and Analysis
Mastering MapReduce: MapReduce for Big Data Management and Analysis
Teradata Aster
 
Key Considerations for Putting Hadoop in Production SlideShare
Key Considerations for Putting Hadoop in Production SlideShareKey Considerations for Putting Hadoop in Production SlideShare
Key Considerations for Putting Hadoop in Production SlideShare
MapR Technologies
 
Time series Analytics - a deep dive into ADX Azure Data Explorer @Data Saturd...
Time series Analytics - a deep dive into ADX Azure Data Explorer @Data Saturd...Time series Analytics - a deep dive into ADX Azure Data Explorer @Data Saturd...
Time series Analytics - a deep dive into ADX Azure Data Explorer @Data Saturd...
Riccardo Zamana
 
Data analysis trend 2015 2016 v071
Data analysis trend 2015 2016 v071Data analysis trend 2015 2016 v071
Data analysis trend 2015 2016 v071
Chun Myung Kyu
 
EsgynDB: A Big Data Engine. Simplifying Fast and Reliable Mixed Workloads
EsgynDB: A Big Data Engine. Simplifying Fast and Reliable Mixed Workloads EsgynDB: A Big Data Engine. Simplifying Fast and Reliable Mixed Workloads
EsgynDB: A Big Data Engine. Simplifying Fast and Reliable Mixed Workloads
Srikanth Ramakrishnan
 
Real-time Big Data Analytics in the IBM SoftLayer Cloud with VoltDB
Real-time Big Data Analytics in the IBM SoftLayer Cloud with VoltDBReal-time Big Data Analytics in the IBM SoftLayer Cloud with VoltDB
Real-time Big Data Analytics in the IBM SoftLayer Cloud with VoltDB
VoltDB
 
The Scout24 Data Landscape Manifesto: Building an Opinionated Data Platform
The Scout24 Data Landscape Manifesto: Building an Opinionated Data PlatformThe Scout24 Data Landscape Manifesto: Building an Opinionated Data Platform
The Scout24 Data Landscape Manifesto: Building an Opinionated Data Platform
Rising Media Ltd.
 
SQL In Hadoop: Big Data Innovation Without the Risk
SQL In Hadoop: Big Data Innovation Without the RiskSQL In Hadoop: Big Data Innovation Without the Risk
SQL In Hadoop: Big Data Innovation Without the Risk
Inside Analysis
 
From BI Developer to Data Engineer with Oracle Analytics Cloud, Data Lake
From BI Developer to Data Engineer with Oracle Analytics Cloud, Data LakeFrom BI Developer to Data Engineer with Oracle Analytics Cloud, Data Lake
From BI Developer to Data Engineer with Oracle Analytics Cloud, Data Lake
Rittman Analytics
 
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
Kai Wähner
 
MongoDB in a Mainframe World
MongoDB in a Mainframe WorldMongoDB in a Mainframe World
MongoDB in a Mainframe World
MongoDB
 

What's hot (20)

MongoDB company and case studies - john hong
MongoDB company and case studies - john hong MongoDB company and case studies - john hong
MongoDB company and case studies - john hong
 
Data Democratization at Nubank
 Data Democratization at Nubank Data Democratization at Nubank
Data Democratization at Nubank
 
A Journey to a Serverless Business Intelligence, Machine Learning and Big Dat...
A Journey to a Serverless Business Intelligence, Machine Learning and Big Dat...A Journey to a Serverless Business Intelligence, Machine Learning and Big Dat...
A Journey to a Serverless Business Intelligence, Machine Learning and Big Dat...
 
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
Customer Event Hub – a modern Customer 360° view with DataStax Enterprise (DSE)
 
The State of Streaming Analytics: The Need for Speed and Scale
The State of Streaming Analytics: The Need for Speed and ScaleThe State of Streaming Analytics: The Need for Speed and Scale
The State of Streaming Analytics: The Need for Speed and Scale
 
Extreme Analytics @ eBay
Extreme Analytics @ eBayExtreme Analytics @ eBay
Extreme Analytics @ eBay
 
The Scout24 Data Platform (A Technical Deep Dive)
The Scout24 Data Platform (A Technical Deep Dive)The Scout24 Data Platform (A Technical Deep Dive)
The Scout24 Data Platform (A Technical Deep Dive)
 
50 Shades of Data - Dutch Oracle Architects Platform (February 2018)
50 Shades of Data - Dutch Oracle Architects Platform (February 2018)50 Shades of Data - Dutch Oracle Architects Platform (February 2018)
50 Shades of Data - Dutch Oracle Architects Platform (February 2018)
 
Data Beats Emotions – How DATEV Generates Business Value with Data-driven Dec...
Data Beats Emotions – How DATEV Generates Business Value with Data-driven Dec...Data Beats Emotions – How DATEV Generates Business Value with Data-driven Dec...
Data Beats Emotions – How DATEV Generates Business Value with Data-driven Dec...
 
Mastering MapReduce: MapReduce for Big Data Management and Analysis
Mastering MapReduce: MapReduce for Big Data Management and AnalysisMastering MapReduce: MapReduce for Big Data Management and Analysis
Mastering MapReduce: MapReduce for Big Data Management and Analysis
 
Key Considerations for Putting Hadoop in Production SlideShare
Key Considerations for Putting Hadoop in Production SlideShareKey Considerations for Putting Hadoop in Production SlideShare
Key Considerations for Putting Hadoop in Production SlideShare
 
Time series Analytics - a deep dive into ADX Azure Data Explorer @Data Saturd...
Time series Analytics - a deep dive into ADX Azure Data Explorer @Data Saturd...Time series Analytics - a deep dive into ADX Azure Data Explorer @Data Saturd...
Time series Analytics - a deep dive into ADX Azure Data Explorer @Data Saturd...
 
Data analysis trend 2015 2016 v071
Data analysis trend 2015 2016 v071Data analysis trend 2015 2016 v071
Data analysis trend 2015 2016 v071
 
EsgynDB: A Big Data Engine. Simplifying Fast and Reliable Mixed Workloads
EsgynDB: A Big Data Engine. Simplifying Fast and Reliable Mixed Workloads EsgynDB: A Big Data Engine. Simplifying Fast and Reliable Mixed Workloads
EsgynDB: A Big Data Engine. Simplifying Fast and Reliable Mixed Workloads
 
Real-time Big Data Analytics in the IBM SoftLayer Cloud with VoltDB
Real-time Big Data Analytics in the IBM SoftLayer Cloud with VoltDBReal-time Big Data Analytics in the IBM SoftLayer Cloud with VoltDB
Real-time Big Data Analytics in the IBM SoftLayer Cloud with VoltDB
 
The Scout24 Data Landscape Manifesto: Building an Opinionated Data Platform
The Scout24 Data Landscape Manifesto: Building an Opinionated Data PlatformThe Scout24 Data Landscape Manifesto: Building an Opinionated Data Platform
The Scout24 Data Landscape Manifesto: Building an Opinionated Data Platform
 
SQL In Hadoop: Big Data Innovation Without the Risk
SQL In Hadoop: Big Data Innovation Without the RiskSQL In Hadoop: Big Data Innovation Without the Risk
SQL In Hadoop: Big Data Innovation Without the Risk
 
From BI Developer to Data Engineer with Oracle Analytics Cloud, Data Lake
From BI Developer to Data Engineer with Oracle Analytics Cloud, Data LakeFrom BI Developer to Data Engineer with Oracle Analytics Cloud, Data Lake
From BI Developer to Data Engineer with Oracle Analytics Cloud, Data Lake
 
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
WJAX 2013 Slides online: Big Data beyond Apache Hadoop - How to integrate ALL...
 
MongoDB in a Mainframe World
MongoDB in a Mainframe WorldMongoDB in a Mainframe World
MongoDB in a Mainframe World
 

Similar to SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 

Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLBringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Keshav Murthy
 
Introducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSONIntroducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSON
Keshav Murthy
 
Querying NoSQL with SQL - MIGANG - July 2017
Querying NoSQL with SQL - MIGANG - July 2017Querying NoSQL with SQL - MIGANG - July 2017
Querying NoSQL with SQL - MIGANG - July 2017
Matthew Groves
 
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it tooQuerying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
All Things Open
 
Querying NoSQL with SQL - KCDC - August 2017
Querying NoSQL with SQL - KCDC - August 2017Querying NoSQL with SQL - KCDC - August 2017
Querying NoSQL with SQL - KCDC - August 2017
Matthew Groves
 
From SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSONFrom SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSON
Keshav Murthy
 
Docker Summit MongoDB - Data Democratization
Docker Summit MongoDB - Data Democratization Docker Summit MongoDB - Data Democratization
Docker Summit MongoDB - Data Democratization
Chris Grabosky
 
Json data modeling june 2017 - pittsburgh tech fest
Json data modeling   june 2017 - pittsburgh tech festJson data modeling   june 2017 - pittsburgh tech fest
Json data modeling june 2017 - pittsburgh tech fest
Matthew Groves
 
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Keshav Murthy
 
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
Keshav Murthy
 
Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...
EDB
 
MongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB Stitch Introduction
MongoDB Stitch Introduction
MongoDB
 
N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.
Keshav Murthy
 
Utilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and IndexingUtilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and Indexing
Keshav Murthy
 
Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.
Keshav Murthy
 
Big Data for Small Businesses & Startups
Big Data for Small Businesses & StartupsBig Data for Small Businesses & Startups
Big Data for Small Businesses & Startups
Fujio Turner
 
JSON Data Modeling - July 2018 - Tulsa Techfest
JSON Data Modeling - July 2018 - Tulsa TechfestJSON Data Modeling - July 2018 - Tulsa Techfest
JSON Data Modeling - July 2018 - Tulsa Techfest
Matthew Groves
 
JSON Data Modeling - GDG Indy - April 2020
JSON Data Modeling - GDG Indy - April 2020JSON Data Modeling - GDG Indy - April 2020
JSON Data Modeling - GDG Indy - April 2020
Matthew Groves
 
Social Stream Analysis Use Cases
Social Stream Analysis Use Cases Social Stream Analysis Use Cases
Social Stream Analysis Use Cases
WSO2
 
Data Marketplace - Rethink the Data
Data Marketplace - Rethink the DataData Marketplace - Rethink the Data
Data Marketplace - Rethink the Data
Denodo
 

Similar to SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications  (20)

Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLBringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
 
Introducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSONIntroducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSON
 
Querying NoSQL with SQL - MIGANG - July 2017
Querying NoSQL with SQL - MIGANG - July 2017Querying NoSQL with SQL - MIGANG - July 2017
Querying NoSQL with SQL - MIGANG - July 2017
 
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it tooQuerying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
 
Querying NoSQL with SQL - KCDC - August 2017
Querying NoSQL with SQL - KCDC - August 2017Querying NoSQL with SQL - KCDC - August 2017
Querying NoSQL with SQL - KCDC - August 2017
 
From SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSONFrom SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSON
 
Docker Summit MongoDB - Data Democratization
Docker Summit MongoDB - Data Democratization Docker Summit MongoDB - Data Democratization
Docker Summit MongoDB - Data Democratization
 
Json data modeling june 2017 - pittsburgh tech fest
Json data modeling   june 2017 - pittsburgh tech festJson data modeling   june 2017 - pittsburgh tech fest
Json data modeling june 2017 - pittsburgh tech fest
 
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
 
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
 
Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...Application Development & Database Choices: Postgres Support for non Relation...
Application Development & Database Choices: Postgres Support for non Relation...
 
MongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB Stitch Introduction
MongoDB Stitch Introduction
 
N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.
 
Utilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and IndexingUtilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and Indexing
 
Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.
 
Big Data for Small Businesses & Startups
Big Data for Small Businesses & StartupsBig Data for Small Businesses & Startups
Big Data for Small Businesses & Startups
 
JSON Data Modeling - July 2018 - Tulsa Techfest
JSON Data Modeling - July 2018 - Tulsa TechfestJSON Data Modeling - July 2018 - Tulsa Techfest
JSON Data Modeling - July 2018 - Tulsa Techfest
 
JSON Data Modeling - GDG Indy - April 2020
JSON Data Modeling - GDG Indy - April 2020JSON Data Modeling - GDG Indy - April 2020
JSON Data Modeling - GDG Indy - April 2020
 
Social Stream Analysis Use Cases
Social Stream Analysis Use Cases Social Stream Analysis Use Cases
Social Stream Analysis Use Cases
 
Data Marketplace - Rethink the Data
Data Marketplace - Rethink the DataData Marketplace - Rethink the Data
Data Marketplace - Rethink the Data
 

More from Keshav Murthy

N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0
Keshav Murthy
 
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
Keshav Murthy
 
Couchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing featuresCouchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing features
Keshav Murthy
 
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram VemulapalliN1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
Keshav Murthy
 
Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.
Keshav Murthy
 
Couchbase Query Workbench Enhancements By Eben Haber
Couchbase Query Workbench Enhancements  By Eben Haber Couchbase Query Workbench Enhancements  By Eben Haber
Couchbase Query Workbench Enhancements By Eben Haber
Keshav Murthy
 
Mindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developersMindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developers
Keshav Murthy
 
Couchbase N1QL: Index Advisor
Couchbase N1QL: Index AdvisorCouchbase N1QL: Index Advisor
Couchbase N1QL: Index Advisor
Keshav Murthy
 
N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0
Keshav Murthy
 
Tuning for Performance: indexes & Queries
Tuning for Performance: indexes & QueriesTuning for Performance: indexes & Queries
Tuning for Performance: indexes & Queries
Keshav Murthy
 
Understanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune QueriesUnderstanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune Queries
Keshav Murthy
 
Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5
Keshav Murthy
 
Enterprise Architect's view of Couchbase 4.0 with N1QL
Enterprise Architect's view of Couchbase 4.0 with N1QLEnterprise Architect's view of Couchbase 4.0 with N1QL
Enterprise Architect's view of Couchbase 4.0 with N1QL
Keshav Murthy
 
Drilling on JSON
Drilling on JSONDrilling on JSON
Drilling on JSON
Keshav Murthy
 
Accelerating analytics on the Sensor and IoT Data.
Accelerating analytics on the Sensor and IoT Data. Accelerating analytics on the Sensor and IoT Data.
Accelerating analytics on the Sensor and IoT Data.
Keshav Murthy
 
You know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on InformixYou know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on Informix
Keshav Murthy
 
Informix SQL & NoSQL: Putting it all together
Informix SQL & NoSQL: Putting it all togetherInformix SQL & NoSQL: Putting it all together
Informix SQL & NoSQL: Putting it all together
Keshav Murthy
 
Informix SQL & NoSQL -- for Chat with the labs on 4/22
Informix SQL & NoSQL -- for Chat with the labs on 4/22Informix SQL & NoSQL -- for Chat with the labs on 4/22
Informix SQL & NoSQL -- for Chat with the labs on 4/22
Keshav Murthy
 
NoSQL Deepdive - with Informix NoSQL. IOD 2013
NoSQL Deepdive - with Informix NoSQL. IOD 2013NoSQL Deepdive - with Informix NoSQL. IOD 2013
NoSQL Deepdive - with Informix NoSQL. IOD 2013
Keshav Murthy
 
Informix NoSQL & Hybrid SQL detailed deep dive
Informix NoSQL & Hybrid SQL detailed deep diveInformix NoSQL & Hybrid SQL detailed deep dive
Informix NoSQL & Hybrid SQL detailed deep dive
Keshav Murthy
 

More from Keshav Murthy (20)

N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0
 
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
 
Couchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing featuresCouchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing features
 
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram VemulapalliN1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
 
Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.
 
Couchbase Query Workbench Enhancements By Eben Haber
Couchbase Query Workbench Enhancements  By Eben Haber Couchbase Query Workbench Enhancements  By Eben Haber
Couchbase Query Workbench Enhancements By Eben Haber
 
Mindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developersMindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developers
 
Couchbase N1QL: Index Advisor
Couchbase N1QL: Index AdvisorCouchbase N1QL: Index Advisor
Couchbase N1QL: Index Advisor
 
N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0
 
Tuning for Performance: indexes & Queries
Tuning for Performance: indexes & QueriesTuning for Performance: indexes & Queries
Tuning for Performance: indexes & Queries
 
Understanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune QueriesUnderstanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune Queries
 
Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5
 
Enterprise Architect's view of Couchbase 4.0 with N1QL
Enterprise Architect's view of Couchbase 4.0 with N1QLEnterprise Architect's view of Couchbase 4.0 with N1QL
Enterprise Architect's view of Couchbase 4.0 with N1QL
 
Drilling on JSON
Drilling on JSONDrilling on JSON
Drilling on JSON
 
Accelerating analytics on the Sensor and IoT Data.
Accelerating analytics on the Sensor and IoT Data. Accelerating analytics on the Sensor and IoT Data.
Accelerating analytics on the Sensor and IoT Data.
 
You know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on InformixYou know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on Informix
 
Informix SQL & NoSQL: Putting it all together
Informix SQL & NoSQL: Putting it all togetherInformix SQL & NoSQL: Putting it all together
Informix SQL & NoSQL: Putting it all together
 
Informix SQL & NoSQL -- for Chat with the labs on 4/22
Informix SQL & NoSQL -- for Chat with the labs on 4/22Informix SQL & NoSQL -- for Chat with the labs on 4/22
Informix SQL & NoSQL -- for Chat with the labs on 4/22
 
NoSQL Deepdive - with Informix NoSQL. IOD 2013
NoSQL Deepdive - with Informix NoSQL. IOD 2013NoSQL Deepdive - with Informix NoSQL. IOD 2013
NoSQL Deepdive - with Informix NoSQL. IOD 2013
 
Informix NoSQL & Hybrid SQL detailed deep dive
Informix NoSQL & Hybrid SQL detailed deep diveInformix NoSQL & Hybrid SQL detailed deep dive
Informix NoSQL & Hybrid SQL detailed deep dive
 

Recently uploaded

Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 

Recently uploaded (20)

Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 

SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 

  • 1. SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications Gerald Sangudi | @sangudi | Chief Architect | Couchbase Keshav Murthy| @rkeshavmurthy | Director | Couchbase Team @N1QL
  • 2. ©2015 Couchbase Inc. 2 Agenda Why NoSQL?  JSON Data Modeling  SQL for JSON  Java APIs  Ecosystem
  • 3. ©2015 Couchbase Inc. 3 Major Enterprises Across Industries are Adopting NoSQL 3 CommunicationsTechnology Travel & Hospitality Media & Entertainment E-Commerce & Digital Advertising Retail & Apparel Games & GamingFinance & Business Services
  • 5. ©2015 Couchbase Inc. 5 Why NoSQL? Agility Scalability Performance Availability
  • 6. ©2015 Couchbase Inc. 6 Why NoSQL? Agility  Schema flexibility  Easier management of change  In the business requirements  In the structure of the data  Change is inevitable
  • 7. ©2015 Couchbase Inc. 7 Why NoSQL? Scalability  Elastic scaling  Size your cluster for today  Scale out on demand  Cost effective scaling  Commodity hardware  On premise or on cloud  Scale OUT instead of Scale UP
  • 8. ©2015 Couchbase Inc. 8 Why NoSQL? Performance  NoSQL systems are optimized for specific access patterns  Low response time for web & mobile user experience  Millisecond latency  Consistently high throughput to handle growth
  • 9. ©2015 Couchbase Inc. 9 Why NoSQL? Availability  Built-in replication and fail-over  No application downtime when hardware fails  Online maintenance & upgrade  No application downtime
  • 10. ©2015 Couchbase Inc. 10 NoSQL Landscape Document • Couchbase • MongoDB • DynamoDB • DocumentDB Graph • OrientDB • Neo4J • DEX • GraphBase Key-Value • Couchbase • Riak • BerkeleyDB • Redis • … Wide Column • Hbase • Cassandra • Hypertable
  • 12. ©2015 Couchbase Inc. 12 Properties of Real-World Data  Rich structure – Attributes, Sub-structure  Relationships – To other data  Value evolution – Data is updated  Structure evolution – Data is reshaped Customer Name DOB Billing Connections Purchases
  • 13. ©2015 Couchbase Inc. 13 Modeling Data in RelationalWorld Billing ConnectionsPurchases Contacts Customer  Rich structure  Normalize & JOIN Queries  Relationships  JOINS and Constraints  Value evolution  INSERT, UPDATE, DELETE  Structure evolution  ALTERTABLE  Application Downtime  Application Migration  ApplicationVersioning
  • 14. ©2015 Couchbase Inc. 14 Using JSON For RealWorld Data CustomerID Name DOB CBL2015 Jane Smith 1990-01-30 Table: Customer { "Name" : "Jane Smith", "DOB" : "1990-01-30” } Customer DocumentKey: CBL2015  The primary (CustomerID) becomes the DocumentKey  Column name-Column value become KEY-VALUE pair. { "Name" : { "fname": "Jane ", "lname": "Smith” } "DOB" : "1990-01-30” } OR
  • 15. ©2015 Couchbase Inc. 15 Using JSON to Store Data CustomerID Name DOB CBL2015 Jane Smith 1990-01-30 Table: Customer { "Name" : "Jane Smith", "DOB" : "1990-01-30", "Billing" : [ { "type" : "visa", "cardnum" : "5827-2842-2847-3909", "expiry" : "2019-03" } ] } Customer DocumentKey: CBL2015 CustomerID Type Cardnum Expiry CBL2015 visa 5827… 2019-03 Table: Billing  Rich Structure & Relationships – Billing information is stored as a sub-document – There could be more than a single credit card. So, use an array.
  • 16. ©2015 Couchbase Inc. 16 Using JSON to Store Data CustomerID Name DOB CBL2015 Jane Smith 1990-01-30 Table: Customer { "Name" : "Jane Smith", "DOB" : "1990-01-30", "Billing" : [ { "type" : "visa", "cardnum" : "5827-2842-2847-3909", "expiry" : "2019-03" }, { "type" : "master", "cardnum" : "6274-2542-5847-3949", "expiry" : "2018-12" } ] } Customer DocumentKey: CBL2015 CustomerID Type Cardnum Expiry CBL2015 visa 5827… 2019-03 CBL2015 master 6274… 2018-12 Table: Billing  Value evolution  Simply add additional array element or update a value.
  • 17. ©2015 Couchbase Inc. 17 Using JSON to Store Data CustomerID ConnId Name CBL2015 XYZ987 Joe Smith CBL2015 SKR007 Sam Smith Table: Connections { "Name" : "Jane Smith", "DOB" : "1990-01-30", "Billing" : [ { "type" : "visa", "cardnum" : "5827-2842-2847-3909", "expiry" : "2019-03" }, { "type" : "master", "cardnum" : "6274-2542-5847-3949", "expiry" : "2018-12" } ], "Connections" : [ { "ConnId" : "XYZ987", "Name" : "Joe Smith" }, { "ConnId" : ”SKR007", "Name" : ”Sam Smith" } } Customer DocumentKey: CBL2015  Structure evolution  Simply add new key-value pairs  No downtime to add new KV pairs  Applications can validate data  Structure evolution over time.  Relations via Reference
  • 18. ©2015 Couchbase Inc. 18 Using JSON to Store Data { "Name" : "Jane Smith", "DOB" : "1990-01-30", "Billing" : [ { "type" : "visa", "cardnum" : "5827-2842-2847-3909", "expiry" : "2019-03" }, { "type" : "master", "cardnum" : "6274-2842-2847-3909", "expiry" : "2019-03" } ], "Connections" : [ { "CustId" : "XYZ987", "Name" : "Joe Smith" }, { "CustId" : "PQR823", "Name" : "Dylan Smith" } { "CustId" : "PQR823", "Name" : "Dylan Smith" } ], "Purchases" : [ { "id":12, item: "mac", "amt": 2823.52 } { "id":19, item: "ipad2", "amt": 623.52 } ] } DocumentKey: CBL2015 CustomerID Name DOB CBL2015 Jane Smith 1990-01-30 Customer ID Type Cardnum Expiry CBL2015 visa 5827… 2019-03 CBL2015 maste r 6274… 2018-12 CustomerID ConnId Name CBL2015 XYZ987 Joe Smith CBL2015 SKR007 Sam Smith CustomerID item amt CBL2015 mac 2823.52 CBL2015 ipad2 623.52 CustomerID ConnId Name CBL2015 XYZ987 Joe Smith CBL2015 SKR007 Sam Smith Contacts Customer Billing ConnectionsPurchases
  • 19. ©2015 Couchbase Inc. 19 Models for Representing Data Data Concern Relational Model JSON Document Model (NoSQL) Rich Structure  Multiple flat tables  Constant assembly / disassembly  Documents  No assembly required! Relationships  Represented  Queried (SQL)  Represented  Queried? Not until now… Value Evolution  Data can be updated  Data can be updated Structure Evolution  Uniform and rigid  Manual change (disruptive)  Flexible  Dynamic change
  • 21. ©2015 Couchbase Inc. 21 Why SQL for JSON  NoSQL systems provide specializedAPIs  Key-Value get and set  Script based query APIs  Limited declarative query  Richer query is needed
  • 22. ©2015 Couchbase Inc. 22 Client Side Querying is Inadequate Find High-Value Customers with Orders > $10000 Query customer objects from database • Complex codes and logic • Inefficient processing on client side For each customer object Find all the order objects for the customer Calculate the total amount for each order Sum up the grand total amount for all orders If grand total amount > $10000, Extract customer data Add customer to the high-value customer list Sort the high-value customer list LOOPING OVER MILLIONS OF CUSTOMERS IN APPLICATION!!!
  • 23. ©2015 Couchbase Inc. 23 Goal of Query for JSON Give developers and enterprises an expressive, powerful, and complete language for querying, transforming, and manipulating JSON data.
  • 24.
  • 25. ©2015 Couchbase Inc. 25 Industry Is Choosing SQL to Query JSON  JSON support in SQL – IBM Informix – Oracle – PostgreSQL – MySQL  Microsoft: SQL for DocumentDB  UC San Diego: SQL++  Couchbase: N1QL
  • 26. ©2015 Couchbase Inc. 26 ResultSet
  • 27. ©2015 Couchbase Inc. 27 { "Name" : "Jane Smith", "DOB" : "1990-01-30", "Billing" : [ { "type" : "visa", "cardnum" : "5827-2842-2847-3909", "expiry" : "2019-03" }, { "type" : "master", "cardnum" : "6274-2842-2847-3909", "expiry" : "2019-03" } ], "Connections" : [ { "CustId" : "XYZ987", "Name" : "Joe Smith" }, { "CustId" : "PQR823", "Name" : "Dylan Smith" } { "CustId" : "PQR823", "Name" : "Dylan Smith" } ], "Purchases" : [ { "id":12, item: "mac", "amt": 2823.52 } { "id":19, item: "ipad2", "amt": 623.52 } ] } LoyaltyInfo ResultDocuments Orders CUSTOMER
  • 28. ©2015 Couchbase Inc. 28 N1QL examples SELECT d.C_ZIP, SUM(ORDLINE.OL_QUANTITY) AS TOTALQTY FROM CUSTOMER d UNNEST ORDERS as CUSTORDERS UNNEST CUSTORDERS.ORDER_LINE AS ORDLINE WHERE d.C_STATE = ”NY” GROUP BY d.C_ZIP ORDER BY TOTALQTY DESC; INSERT INTO CUSTOMER("PQR847", {"C_ID":4723, "Name":"Joe"}); UPDATE CUSTOMER c SET c.STATE=“CA”, c.C_ZIP = 94501 WHERE c.ID = 4723;
  • 29. ©2015 Couchbase Inc. 29 SELECT Statement SELECT customers.id, customers.NAME.lastname, customers.NAME.firstname Sum(orderline.amount) FROM orders UNNEST orders.lineitems AS orderline JOIN customers ON KEYS orders.custid WHERE customers.state = 'NY' GROUP BY customers.id, customers.NAME.lastname HAVING sum(orderline.amount) > 10000 ORDER BY sum(orderline.amount) DESC • Dotted sub-document reference • Names are CASE-SENSITIVE • UNNEST to flatten the arrays JOINS with Document KEY of customers
  • 30. ©2015 Couchbase Inc. 30 Composable SELECT statement SELECT * FROM ( SELECT a, b, c FROM us_cust WHERE x = 1 ORDER BY x LIMIT 100 OFFSET 0 UNION ALL SELECT a, b, c FROM canada_cust WHERE y = 2 ORDER BY x LIMIT 100 OFFSET 0) AS newtab LEFT OUTER JOIN contacts ON KEYS newtab.c.contactid ORDER BY a, b, c LIMIT 10 OFFSET 0
  • 31. ©2015 Couchbase Inc. 31 SELECT Statement Highlights  Querying across relationships – JOINs – Subqueries  Aggregation – MIN, MAX – SUM, COUNT, AVG,ARRAY_AGG [ DISTINCT ]  Combining result sets using set operators – UNION, UNIONALL, INTERSECT, EXCEPT
  • 32. ©2015 Couchbase Inc. 32 N1QL Query Operators [ 1 of 2 ]  USE KEYS … – Direct primary key lookup bypassing index scans – Ideal for hash-distributed datastore – Available in SELECT, UPDATE, DELETE  JOIN … ON KEYS … – Nested loop JOIN using key relationships – Ideal for hash-distributed datastore – Current implementation supports INNER and LEFT OUTER joins
  • 33. ©2015 Couchbase Inc. 33 N1QL Query Operators [ 2 of 2 ]  NEST – Special JOIN that embeds external child documents under their parent – Ideal for JSON encapsulation  UNNEST – Flattening JOIN that surfaces nested objects as top-level documents – Ideal for decomposing JSON hierarchies JOIN, NEST, and UNNEST can be chained in any combination
  • 34. ©2015 Couchbase Inc. 34 N1QL Expressions for JSON ©2014 Couchbase, Inc. 34 Ranging over collections • WHERE ANY c IN children SATISFIES c.age > 10 END • WHERE EVERY r IN ratings SATISFIES r > 3 END Mapping with filtering • ARRAY c.name FOR c IN children WHEN c.age > 10 END Deep traversal, SET, and UNSET • WHERE ANY node WITHIN request SATISFIES node.type = “xyz” END • UPDATE doc UNSET c.field1 FOR c WITHIN doc END DynamicConstruction • SELECT { “a”: expr1, “b”: expr2 } AS obj1, name FROM … // Dynamic object • SELECT [ a, b ] FROM … // Dynamic array Nested traversal • SELECT x.y.z, a[0] FROM a.b.c … IS [ NOT ] MISSING • WHERE name IS MISSING
  • 35. ©2015 Couchbase Inc. 35 N1QL DataTypes from JSON N1QL supports all JSON data types  Numbers  Strings  Booleans  Null  Arrays  Objects
  • 36. ©2015 Couchbase Inc. 36 N1QL DataType Handling Non-JSON data types – MISSING – Binary Data type handling  Date functions for string and numeric encodings  Total ordering across all data types – Well defined semantics for ORDER BY and comparison operators  Defined expression semantics for all input data types – No type mismatch errors
  • 37. ©2015 Couchbase Inc. 37 Data Modification Statements  UPDATE … SET … WHERE …  DELETE FROM … WHERE …  INSERT INTO … ( KEY,VALUE ) VALUES …  INSERT INTO … ( KEY …,VALUE … ) SELECT …  MERGE INTO … USING … ON … WHEN [ NOT ] MATCHEDTHEN … Note: Couchbase provides per-document atomicity.
  • 38. ©2015 Couchbase Inc. 38 Data Modification Statements INSERT INTO ORDERS (KEY, VALUE) VALUES ("1.ABC.X382", {"O_ID":482, "O_D_ID":3, "O_W_ID":4}); UPDATE ORDERS SET O_CARRIER_ID = ”ABC987” WHERE O_ID = 482 AND O_D_ID = 3 AND O_W_ID = 4 DELETE FROM NEW_ORDER WHERE NO_D_ID = 291 AND NO_W_ID = 3482 AND NO_O_ID = 2483 JSON literals can be used in any expression
  • 39. ©2015 Couchbase Inc. 39 Index Statements  CREATE INDEX ON …  DROP INDEX …  EXPLAIN … Highlights  Functional indexes – on any data expression  Partial indexes
  • 40. ©2015 Couchbase Inc. 40 Index Overview: Secondary Index  Secondary Index can be created on any combination of attribute names.  CREATE INDEX idx_cust_cardnum customer(ccInfo.cardNumber, postalcode)  Useful in speeding up the queries.  Need to have matching indices with right key- ordering  (ccInfo.cardExpiry, postalCode)  (type, state, lastName firstName) "customer": { "ccInfo": { "cardExpiry": "2015-11-11", "cardNumber”:"1212-232-1234", "cardType": "americanexpress” }, "customerId": "customer534", "dateAdded": "2014-04-06", "dateLastActive”:"2014-05-02”, "emailAddress”:”iles@kertz.name", "firstName": "Mckayla", "lastName": "Brown", "phoneNumber": "1-533-290-6403", "postalCode": "92341", "state": "VT", "type": "customer" } Document key: “customer534”
  • 41. ©2015 Couchbase Inc. 41 Find High-Value Customers with Orders > $10000 SQL for JSON API QUERY VS. Query customer objects from database • Proven and expressive query language • Leverage SQL skills and ecosystem • Extended for JSON • Complex codes and logic • Inefficient processing on client side For each customer object Find all the order objects for the customer Calculate the total amount for each order Sum up the grand total amount for all orders If grand total amount > $10000, Extract customer data Add customer to the high-value customer list Sort the high-value customer list SELECT Customers.ID, Customers.Name, SUM(OrderLine.Amount) FROM Orders UNNEST Orders.LineItems AS OrderLine JOIN Customers ON KEYS Orders.CustID GROUP BY Customers.ID, Customers.Name HAVING SUM(OrderLine.Amount) > 10000 ORDER BY SUM(OrderLine.Amount) DESC LOOPING OVER MILLIONS OF CUSTOMERS IN APPLICATION!!!
  • 42. ©2015 Couchbase Inc. 42 Summary: SQL & N1QL Query Features SQL N1QL Statements  SELECT, INSERT, UPDATE, DELETE, MERGE  SELECT, INSERT, UPDATE, DELETE, MERGE Query Operations  Select, Join, Project, Subqueries  Strict Schema  StrictType checking  Select, Join, Project, Subqueries  Nest & Unnest  Look Ma! NoType Mismatch Errors!  JSON keys act as columns Schema  Predetermined Columns  Fully addressable JSON  Flexible document structure DataTypes  SQL Data types  Conversion Functions  JSON Data types  Conversion Functions Query Processing  INPUT: Sets ofTuples  OUPUT: Set ofTuples  INPUT: Sets of JSON  OUTPUT: Set of JSON
  • 44. ©2015 Couchbase Inc. 44 Java APIs Standard JDBC driver (JDBC 4.0 and 4.1) – Also, standard ODBC Driver JDBC/JSON driver –Extends JDBC for JSON SDKs with Custom Query APIs
  • 45. ©2015 Couchbase Inc. 45 JDBC Driver – JDBC 4.0 and 4.1 – Build an application which can query using SQL or N1QL – Allow easy access to NoSQL data from BI and ETL tools, as well as your own applications JDBC Interface
  • 46. ©2015 Couchbase Inc. 46 Conversion between ANSI SQL and N1QL/JSON Simba Couchbase JDBC Driver  Allows users to infer or define schemas on schema-less JSON data  Converts JSON data to relational data  Based on JDBC 4.0 and 4.1 Standard  Full 64-bit and 32-bit support  Full SQL & N1QL support  Comprehensive unicode support JDBC Driver JDBCInterface DriverImplementation SQL-92 N1QL
  • 47. ©2015 Couchbase Inc. 47 import java.sql.*; import java.util.*; public class Demo { public static void main(String[] args) { String url = "jdbc:couchbase://localhost:8093"; try { Connection conn = DriverManager.getConnection(url); try { System.out.println("Connection successful."); } finally { conn.close(); } } catch (SQLException e) { e.printStackTrace(); } } } JDBC: Connecting
  • 48. ©2015 Couchbase Inc. 48 private static void doQuery(Connection conn) { try { String query = "select SELECT d.C_ZIP, " + "SUM(ORDLINE.OL_QUANTITY) AS TOTALQTY " + "FROM CUSTOMER d " + "GROUP BY d.C_ZIP "; Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); } catch (SQLException e) { System.out.println("Error: " + e.getLocalizedMessage()); } } JDBC: Executing Queries
  • 49. ©2015 Couchbase Inc. 49 Can change the driver to execute in N1QL mode by appending the following to the connection URL: ;UseN1QLMode=1 Try the following N1QL query: SELECT beer.name as beer_name, beer.abv, brewery.name as brewery_name FROM `beer-sample` beer JOIN `beer-sample` brewery ON KEYS [ beer.brewery_id ] WHERE beer.abv > 5 and beer.style != "Lager" and beer.type = "beer" and brewery.type = "brewery" ORDER BY beer.abv DESC LIMIT 5; JDBC: Executing in N1QL Mode
  • 50. ©2015 Couchbase Inc. 50 Java JSR-374  https://www.jcp.org/en/jsr/detail?id=374 This JSR is to provide an update for the Java API for JSON Processing Specification (JSON-P) There are 3 goals for this JSR. • Support for JSON Pointer and JSON Patch • Add editing/transformation operations to JSON object model • Update the API to work with Java SE 8  JDBC will need to add enhanced JSON support. – Couchbase has engaged with JDBC Committee
  • 51. ©2015 Couchbase Inc. 51 SDKs with Custom Query APIs // raw string query N1qlQueryResult queryResult = bucket.query(N1qlQuery.simple("SELECT * FROM beer-sample LIMIT 10")); // using the DSL N1qlQueryResult query = bucket.query(select("*").from("beer-sample").limit(10)); bucket .query(N1qlQuery.simple(select("*").from(i("beer-sample")).limit(10))) .flatMap(AsyncN1qlQueryResult::rows) .toBlocking() .forEach(row -> System.out.println(row.value())); • Fluent APIs for N1QL • Use Domain Specific Language extensions • Works well with query builders to provide features like auto completion • Provides help with complex expressions like CASE,ANY, EVERY, etc. • Supports parameter Passing • Supports querying asynchronously
  • 53. ©2015 Couchbase Inc. 53 Ecosystem Integration
  • 54. ©2015 Couchbase Inc. 54 Try SQL for JSON N1QL is available in Couchbase 4.0 –http://query.couchbase.com –Online Interactive Tutorial Ask us questions – Couchbase forums, Stack Overflow, @N1QL
  • 55. Thank you Q & A Gerald Sangudi | @sangudi | Chief Architect | Couchbase Keshav Murthy| @rkeshavmurthy | Director | Couchbase @N1QL | query.couchbase.com

Editor's Notes

  1. In today’s world of agile business, Java developers and organizations benefit when JSON-based NoSQL databases and SQL-based querying come together. NoSQL provides schema flexibility and elastic scaling. SQL provides expressive, independent data access. Java developers need to deliver apps that readily evolve, perform, and scale with changing business needs. Organizations need rapid access to their operational data, using standard analytical tools, for insight into their business. In this session, you will learn to build apps that combine NoSQL and SQL for agility, performance, and scalability. This includes • JSON data modeling • Indexing • Tool integration
  2. KEY POINT: MAJOR ENTERPRISES ACROSS NUMEROUS INDUSTRIES ARE ADOPTING COUCHBASE NOSQL TECHNOLOGY TO SUPPORT THEIR DATA MANAGEMENT NEEDS. We’ve looked at what’s driving NoSQL and the advantages it delivers. So who are some of the companies that are actually adopting Couchbase? As this slide shows, major enterprises across many different industries are adopting Couchbase NoSQL solution. You see many innovative Internet companies here – like eBay, LinkedIn, Orbitz, and PayPal. They were the early adopters of NoSQL. But it’s clear that NoSQL is now being adopted by a broad range of companies in many other industries: Consumer electronics and technology companies like Apple and Cisco Retail companies like Walmart and Tesco Financial Services companies like VISA and Wells Fargo Telcos like Verizon, AT&T and Vodafone What’s also interesting is that we’re seeing the use of NoSQL expand inside many of these companies. Orbitz, the online travel company, is a great example – they started using Couchbase to store their hotel rate data, and now they use Couchbase in many other ways. So the big takeaway is that an increasing number of companies across industries are seeing the value of NoSQL for a growing number of use cases.
  3. SQL (relational) databases are great. They give you LOT OF functionality. Great set of abstractions (tables, columns, data types, constraints, triggers, SQL, ACID TRANSACTIONS, stored procedures and more) at a highly reasonable cost. The cost is going down every day. One thing RDBMS does not handle well is CHANGE. Change of schema (both logical and physical), change of hardware, change of capacity. Appdev: Changes are required not only during initial dev but also after going long-beta or production. Quick response to market feedback differentiates winners from loosers. Scalability: Many of the digital economy business applications (every business is a digital economy business) expect high throughput (> 100K gets/s) with millions of customers. Physics of servers dictate we distribute the data to multiple nodes. Consistent Perf: With high throughput comes high responsibility: consistently low latency queries. Reliability: It’s not IF but WHEN some of the hardware goes down, be it disk, memory, server. Your business can’t be at the mercy of hardware. Java and JDBC have had a very long and successful relationship. JDBC Provides java connectivity to relational databases via SQL. All of the application servers support using JDBC for persistence. Lot of the object-relational mappers like hibernate, frameworks like ibatis, spring data all support database access via
  4. SQL (relational) databases are great. They give you LOT OF functionality. Great set of abstractions (tables, columns, data types, constraints, triggers, SQL, ACID TRANSACTIONS, stored procedures and more) at a highly reasonable cost. The cost is going down every day. One thing RDBMS does not handle well is CHANGE. Change of schema (both logical and physical), change of hardware, change of capacity. Change in the CONSTANT. Appdev: Changes are required not only during initial dev but also after going long-beta or production. Quick response to market feedback differentiates winners from loosers. Scalability: Many of the digital economy business applications (every business is a digital economy business) expect high throughput (> 100K gets/s) with millions of customers. Physics of servers dictate we distribute the data to multiple nodes. Consistent Perf: With high throughput comes high responsibility: consistently low latency queries. Reliability: It’s not IF but WHEN some of the hardware goes down, be it disk, memory, server. Your business can’t be at the mercy of hardware. Java and JDBC have had a very long and successful relationship. JDBC Provides java connectivity to relational databases via SQL. All of the application servers support using JDBC for persistence. Lot of the object-relational mappers like hibernate, frameworks like ibatis, spring data all support database access via
  5. SQL (relational) databases are great. They give you LOT OF functionality. Great set of abstractions (tables, columns, data types, constraints, triggers, SQL, ACID TRANSACTIONS, stored procedures and more) at a highly reasonable cost. The cost is going down every day. One thing RDBMS does not handle well is CHANGE. Change of schema (both logical and physical), change of hardware, change of capacity. Appdev: Changes are required not only during initial dev but also after going long-beta or production. Quick response to market feedback differentiates winners from loosers. Scalability: Many of the digital economy business applications (every business is a digital economy business) expect high throughput (> 100K gets/s) with millions of customers. Physics of servers dictate we distribute the data to multiple nodes. Consistent Perf: With high throughput comes high responsibility: consistently low latency queries. Reliability: It’s not IF but WHEN some of the hardware goes down, be it disk, memory, server. Your business can’t be at the mercy of hardware. Java and JDBC have had a very long and successful relationship. JDBC Provides java connectivity to relational databases via SQL. All of the application servers support using JDBC for persistence. Lot of the object-relational mappers like hibernate, frameworks like ibatis, spring data all support database access via
  6. SQL (relational) databases are great. They give you LOT OF functionality. Great set of abstractions (tables, columns, data types, constraints, triggers, SQL, ACID TRANSACTIONS, stored procedures and more) at a highly reasonable cost. The cost is going down every day. One thing RDBMS does not handle well is CHANGE. Change of schema (both logical and physical), change of hardware, change of capacity. Appdev: Changes are required not only during initial dev but also after going long-beta or production. Quick response to market feedback differentiates winners from loosers. Scalability: Many of the digital economy business applications (every business is a digital economy business) expect high throughput (> 100K gets/s) with millions of customers. Physics of servers dictate we distribute the data to multiple nodes. Consistent Perf: With high throughput comes high responsibility: consistently low latency queries. Reliability: It’s not IF but WHEN some of the hardware goes down, be it disk, memory, server. Your business can’t be at the mercy of hardware. Java and JDBC have had a very long and successful relationship. JDBC Provides java connectivity to relational databases via SQL. All of the application servers support using JDBC for persistence. Lot of the object-relational mappers like hibernate, frameworks like ibatis, spring data all support database access via
  7. SQL (relational) databases are great. They give you LOT OF functionality. Great set of abstractions (tables, columns, data types, constraints, triggers, SQL, ACID TRANSACTIONS, stored procedures and more) at a highly reasonable cost. The cost is going down every day. One thing RDBMS does not handle well is CHANGE. Change of schema (both logical and physical), change of hardware, change of capacity. Appdev: Changes are required not only during initial dev but also after going long-beta or production. Quick response to market feedback differentiates winners from loosers. Scalability: Many of the digital economy business applications (every business is a digital economy business) expect high throughput (> 100K gets/s) with millions of customers. Physics of servers dictate we distribute the data to multiple nodes. Consistent Perf: With high throughput comes high responsibility: consistently low latency queries. Reliability: It’s not IF but WHEN some of the hardware goes down, be it disk, memory, server. Your business can’t be at the mercy of hardware. Java and JDBC have had a very long and successful relationship. JDBC Provides java connectivity to relational databases via SQL. All of the application servers support using JDBC for persistence. Lot of the object-relational mappers like hibernate, frameworks like ibatis, spring data all support database access via
  8. NoSQL, although generally accepted as Not Only SQL, generally refers to databases which lack SQL. Implementing generally accepted subset of SQL for flexible data model on a distributed system IS HARD. Once the SQL language, transaction became optional, flurry of databases were created using distinct approaches for common use-cases. KEY-Value simply provided quick access to data for a given KEY. Lot of the databases in this group provide additional functionality compared to memcached. Wide Column databases Graph databases can store large number of arbitrary columns in each row Document databases aggregate data into a hierarchical structure. With JSON is a means to the end. Document databases provide flexible schema,built-in data types, rich structure, implicit relationships using JSON. With lot of these databases simple things like GET and PUT were done via very simple API. Anything compilicated requires long, client side programs. Let’s seen an example.
  9. Let’s look at modeling Customer data.
  10. Rich Structure In relational database, this customers data would be stored in five normalized tables. Each time you want to construct a customer object, you JOIN the data in these tables; Each time you persist, you find the appropriate rows in relevant tables and insert/update. Relationship Enforcement is via referential constraints. Objects are constructed by JOINS, EACH time. Value Evolution Additional values of the SAME TYPE (e.g. additional phone, additional address) is managed by additional ROWS in one of the tables. Customer:contacts will have 1:n relationship. Structure Evolution: This is the most difficult part.changing the structure is difficult, within a table, across tae table. While you can do these via ALTER TABLE, requires downtime, migration and application versioning. This is one of the problem document databases try to handle by representing data in JSON.
  11. Let’s see how to represent customer data in JSON.
  12. So, finally, you have a JSON document that represents a CUSTOMER. In a single JSON document, relationship between the data is implicit by use of sub-structures and arrays and arrays of sub-structures.
  13. SQL language operates on set of relations (table) and then projects another relation (table)
  14. N1QL is a SQL based language designed for JSON. Input is set of related sets of JSON documents. It operates on these documents and produces another set of JSON documents. All of the SQL operattions, select, join, project operations are supported. All of the common statements are supported: SELECT, INSERT, UPDATE, DELETE and MERGE. Additionally, N1QL extends the language to support: -- Fully address, access and modify any part of the JSON document. -- Handle the full flexible schema where schema is self-described by each document. -- key-value pairs could be missing, data types could change and structure could change!
  15. Nielsen session and use case Mention nested sourcing?
  16. This JSR is to provide an update for the Java API for JSON Processing Specification (JSON-P). There are 3 goals for this JSR. * Support for JSON Pointer and JSON Patch After the release of JSR 353, the specifications for JSON Pointer (http://tools.ietf.org/html/rfc6901) and JSON Patch (http://tools.ietf.org/html/rfc6902) have been released. This JSR will update JSON-P to provide support for these specifications. * Add editing/transformation operations to JSON object model The current JSON object model provides immutable JSON objects and arrays. It is useful to provide editing or transformation functionalities to the basic JSON processing. For a JSON object, an operation will be added to remove a name/value pair from the object. For a JSON array, operations will be added to insert, replace, or remove an entry of the array. The builder pattern will be used to handle these operations: a builder is created with the initial JSON object or array, the operations are carried out by the builder, and the edited object or array is finally converted to an immutable JSON object or array. * Update the API to work with Java SE 8 Queries on JSON object model are currently possible, using Java SE 8's stream operations and lambda expressions. However, to make them truly useful and convenient, there is a need for Collectors that return JSON objects or arrays instead of Maps or Lists. This JSR will define some common and useful Collectors. It may also be useful to turn JSON parser events into a stream of events, so that SE 8's stream operations can be used.