5. Couchbase Server
General
purpose
The
Most
complete,
scalable
&
highest
performing
NoSQL
database
Elas-c
scalability
Consistent
high
performance
Always
available
Flexible,
global
deployment
Enterprise
grade
administra-on
Real
-me
big
data
Data
mobility
Developer
focused
6. Couchbase Server
Couchbase
offers
a
full
range
of
Data
Management
solu5ons
High
Availability
Cache
Key
Value
Document
Mobile
device
SSN:
400
658
9993
Pass:
******
7. A Basic Data Model
§ Tables, schemas, constraints
§ Prevailing model for 30+ years
8. A Rich Data Model
8
Person
Name
DOB
Billing
Connec5ons
Purchases
Jane
Smith
Product
Jan-‐30-‐1990
§ Structure and richness of real-world data
§ Drivers: Big Data, agility
§ Enabler: JSON — convenient, standard
9. 9
Basic
Data
Model
Rich
Data
Model
Technology
q Rela-onal
v Document
Building
blocks
§ Flat
tables
ü Rich
objects
Developer
impact
§ Real
world
must
be
translated
§ Objects
must
be
assembled
§ Data
must
be
uniform
§ Change
must
be
an
excep-on
ü Real
world
can
be
reflected
ü Objects
can
be
represented
ü Data
can
be
uniform
or
varied
ü Change
can
be
a
norm
Query
language
q SQL
v N1QL
—
SQL
and
more
Comparing the data models
10. 10
SQL:
Expressive
Power
JSON:
Rich
Data
N1NF
N1QL:
Query
Language
for
Rich
Data
Defining N1QL
11. 11
What does N1QL achieve?
Ø Joy
for
Developers
§ Freedom,
flexibility,
alignment,
produc-vity
§
Best
of
both
—
SQL
and
rich
data
Ø Power
for
Big
Data
Applica5ons
§ Ability
to
index
and
query
rich
data
at
scale
§ Power
of
Couchbase
extended
to
querying
Ø Value
for
Customers
§ Query
technology
for
a
new
era
§ Enabler
for
applica-ons
of
the
future
12. 12
Reading
Data
SELECT
Projec-on
DISTINCT
De-‐duplica-on
FROM
Sourcing
JOIN
INNER,
LEFT
OUTER
WHERE
Filtering
GROUP
BY
Aggrega-on
—
HAVING,
MIN,
MAX,
SUM,
AVG,
COUNT
[
DISTINCT
]
ORDER
BY
Sor-ng
LIMIT,
OFFSET
Paging
UNION*,
INTERSECT*,
EXCEPT*
Set
operators
EXPLAIN
Analyzing
and
tuning
query
execu-on
plans
N1QL Features - Reads
*Upcoming
13. 13
N1QL Features - Writes
Wri5ng
Data
CREATE
INDEX
Create
a
Couchbase
view
index
or
secondary
index*
DROP
INDEX
Drop
an
index
INSERT*
INSERT
using
VALUES
or
SELECT
UPDATE*
UPDATE…WHERE,
with
document-‐level
atomicity
DELETE*
DELETE
FROM…WHERE,
with
document-‐level
atomicity
MERGE*
MERGE
with
INSERT
or
UPDATE,
depending
on
match
*Upcoming
14. 14
N1QL Features - Expressions
Expressions
Literals
Primi-ves
[
0,
‘hello’,
TRUE
]
NULL
Operators
Arithme-c
[
+,
-‐,
*,
/,
%
]
Logical
[
AND,
OR,
NOT
]
Comparison
[
<,
<=,
=,
!=,
>=,
>,
BETWEEN,
IS
NULL
]
Papern
matching
[
LIKE
]
Condi-onal
[
CASE
]
Scalar
func-ons
Numeric
[
trigonometric,
ROUND,
TRUNC,
…
]
String
[
UPPER,
LOWER,
TRIM,
SUBSTR,
…
]
Date
[
string
and
numeric
dates,
NOW,
date
arithme-c*,
…
]
Aggregate
func-ons
MIN,
MAX,
SUM,
AVG,
COUNT
[
DISTINCT
]
Subqueries*
Subqueries
are
full
expressions
*Upcoming
15. 15
Nested
Data
Mul--‐valued
apributes
Arrays
as
apributes
Nested
objects
Mul--‐level
nes-ng
of
objects;
path
naviga-on
NEST
Collec-ng
second
term
into
nested
array
[
INNER,
LEFT
OUTER
]
UNNEST
Flapening
nested
array
[
INNER,
LEFT
OUTER
]
Collec-on
operators
Mapping,
filtering,
predicate,
indexing,
and
slicing
operators
Collec-on
func-ons
Sort,
Reverse,
Dis-nct,
Append,
Concatenate,
Contains…
Collec-on
aggrega-on*
MIN,
MAX,
SUM,
AVG,
COUNT
[
DISTINCT
]
Deep
traversal*
Finding
or
collec-ng
of
matching
elements
WITHIN
any
depth
Array
and
deep
update*
UPDATE
of
matching
elements
IN
arrays
and
WITHIN
any
depth
Construc-on
Dynamic
construc-on
of
objects,
arrays,
and
their
combina-ons
*Upcoming
Rich Data Features - Nesting
16. Features for Rich Data — Heterogeneity
Heterogeneous
Data
Heterogeneous
inputs
Input
data
of
varying
structure
and
type
Heterogeneous
results
Results
of
varying
structure
and
type
Raw
projec-on
Support
for
non-‐tuple,
non-‐object
results
Schema
inference*
Inference
of
result
structure
and
types,
based
on
result
expressions
Missing
apributes
IS
[
NOT
]
MISSING
and
other
operators
and
func-ons
Apribute
removal*
UPDATE…UNSET
to
remove
apributes
Total
ordering*
Comparison
and
ordering
for
all
values,
across
all
types
Implicit
types*
§ Type-‐encoding
func-ons
+
expression
indexes*
§ For
example,
range
scans
on
dates
Closure
JSON
in,
JSON
out
16
*Upcoming
17. 17
Features for Distributed Data
Distributed
Data
Key-‐value
access
§ KEYS
available
in
SELECT,
UPDATE,
DELETE
§ KEYS
used
in
JOIN,
NEST,
subqueries*,
MERGE*
Document
metadata
§ META
func-on
to
access
ID,
TTL,
CAS,
FLAGS…
LIMIT
on
UPDATE
&
DELETE*
§ LIMIT
available
in
write
statements
*Upcoming