couchbase live europe 2015: introducing n1ql – sql for documents
Post on 16-Jul-2015
113 Views
Preview:
TRANSCRIPT
©2015 Couchbase Inc. 2
Agenda
N1QL sessions today
What is N1QL
Language highlights
Architecture
Ecosystem
Next steps
Q & A
©2015 Couchbase Inc. 3
N1QL Sessions Today
Introduction
Hands on workshops (“Querying Big Data”)
Performance and scaling tips
Client-side development
©2015 Couchbase Inc. 5
What is N1QL?
N1QL is a new query language that systematically
extends SQL to document-oriented data
N1QL extends SQL to handle data that is:
Nested: Contains nested objects, arrays
Heterogeneous: Schema-optional, non-uniform
Distributed: Partitioned across a cluster
©2015 Couchbase Inc. 6
What is N1QL?
6
Document Model: Richness and Flexibility
SQL: Expressiveness and Soundness
N1QL is SQL for Documents
©2015 Couchbase Inc. 8
SELECT
Standard SELECT pipeline
SELECT, FROM, WHERE, GROUP BY, ORDER BY, LIMIT, OFFSET
JOINs (by keys)
Subqueries
Aggregation
Set operators
UNION, INTERSECT, EXCEPT
EXPLAIN
©2015 Couchbase Inc. 9
Indexing
CREATE / DROP INDEX
Two types of indexes
View indexes
GSI indexes (new secondary indexes)
©2015 Couchbase Inc. 10
Data writes*
UPDATE
UPDATE … WHERE …
DELETE
DELETE … WHERE …
INSERT
INSERT … VALUES …
INSERT … SELECT …
MERGE
*Experimental in CB 4.0.
*Single-document atomicity.
©2015 Couchbase Inc. 11
Document-oriented Extensions Nested
Paths—user.profile.email, children[0], children[0:2]
NEST, UNNEST
Ranging—FOR EVERY child IN children
Transformations—SELECT {“name”: first_name || last_name}
Non-uniform
IS MISSING
Type checking and conversion
Distributed
Direct lookup—USE KEYS
Efficient joins—ON KEYS
©2015 Couchbase Inc. 13
Topology
Client SDK
App
Index
CB Node
ODBC / JDBC
App
Query
Manager
Data
Index
CB Node
Query
Manager
Data
Index
CB Node
Query
Manager
Data
Index
CB Node
Query
Manager
Data
Index
CB Node
Query
Manager
Data
Index
CB Node
Query
Manager
Data
Connectivity, ecosystem, & rich apps
Node services & modular scaling
Query throughput scales with nodesODBC / JDBC
BI Tool
©2015 Couchbase Inc. 14
Inside a Cluster
Index Services
Clients
Data Services
(1) Request (6) Response
Query Services
(2) Plan: Query to execution plan (5) Evaluate: Documents to results
(3) Scan: Attributes to keys (4) Fetch: Keys to documents
©2015 Couchbase Inc. 15
Inside a Query Node
Index Services
Client
Data Services
FetchScanParse Plan Join Filter
Pre-Aggregate
Offset Limit Project
Data-parallel — Query latency scales with cores
Memory-bound
Pluggable architecture — datastore, indexer, client, …
Request Response
SortAggregate
©2015 Couchbase Inc. 16
Data Service
Projector & Router
Secondary Indexing
Index Scan
Query ServiceIndex Service
SupervisorIndex maintenance &
Scan coordinator
Index#2Index#1
Query Engine
Bucket#1 Bucket#2
DCP StreamIndex#4Index#3
...
Bucket#2
Bucket#1
©2015 Couchbase Inc. 18
Ecosystem
xDBC
App
CB Node
xDBC
ETL
xDBC
BI
xDBC
Visualization
CB Node CB Node
Standards-based drivers
Integrations, partnerships
©2015 Couchbase Inc. 20
Roadmap
DP1
DP2
DP3
DP4
CB4.0 DP
CB4.0 BetaCB4.0 GA
9/2013
2014
Q1
CB Live London2015
©2015 Couchbase Inc. 21
Resources
©2014 Couchbase, Inc. 21
query.couchbase.com
Downloads
Tutorial
Forums
Resources
@N1QL, @couchbase
Stack Overflow
top related