SlideShare a Scribd company logo
Bringing the SQL back to NoSQL
Querying JSON w/N1QL
©2014 Couchbase Inc.
Titanium Sponsors
Platinum Sponsors
Gold Sponsors
©2014 Couchbase Inc.
About Me: Jeff Morris
 Software Engineer @Couchbase
 Maintain several open source projects…
 Official Couchbase .NET SDK
 Linq2Couchbase
 CouchbaseASP.NET Extensions
 Former Enterprise Architect
 Work primarily with .NET, but some Java and arch. ex. with
PHP
 Family, Surfing and Fishing
3
©2014 Couchbase Inc.
Agenda
 Intro
 Couchbase 101, Data in Couchbase
 N1QL
 N1QL vs SQL, Language Structure, Queries and Results
 Advanced
 How do queries work, 2i, Predicate filters
 SDK Support
 RESTAPI,Ad hoc queries, Linq, Java DSL
 Q&A
4
Couchbase 101
Prerequisites…
5
©2014 Couchbase Inc.
Couchbase Server: About
 High throughput, low latency
 Built-in distributed cache
 Commodity hardware
 Distributed, shared nothing architecture
 Nodes are peers
 Strong consistency
 Elastic scalability
 XDCR
©2014 Couchbase Inc.
Storage Engine
Cluster Manager
Data Service
Projector & Router
New Services in Couchbase Server 4.0
Query ServiceIndex Service
Supervisor
Index maintenance &
Scan coordinator
Index#2Index#1
Query Processor
cbq-engine
Bucket#1 Bucket#2
DCP Stream
Index#4Index#3
...
B
u
c
k
e
t
#
2
B
u
c
k
e
t
#
1
1809311211 18901
ManagedCache
©2014 Couchbase Inc.
Full Cluster Architecture
STORAGE
Couchbase Server 1
SHARD
7
SHARD
9
SHARD
5
SHARDSHARDSHARD
Managed
Cache
Cluster
Manager
Cluster
Manager
Managed
Cache
Storage
Data Service
Index Service
Query Service STORAGE
Couchbase Server 2
SHARD
7
SHARD
9
SHARD
5
SHARDSHARDSHARD
Managed
Cache
Cluster
Manager
Cluster
Manager
Managed
Cache
Storage
Data Service
Index Service
Query Service STORAGE
Couchbase Server 3
SHARD
7
SHARD
9
SHARD
5
SHARDSHARDSHARD
Managed
Cache
Cluster
Manager
Cluster
Manager
Managed
Cache
Storage
Data Service
Index Service
Query Service STORAGE
Couchbase Server 4
SHARD
7
SHARD
9
SHARD
5
SHARDSHARDSHARD
Managed
Cache
Cluster
Manager
Cluster
Manager
Managed
Cache
Storage
Data Service
Index Service
Query Service STORAGE
Couchbase Server 5
SHARD
7
SHARD
9
SHARD
5
SHARDSHARDSHARD
Managed
Cache
Cluster
Manager
Cluster
Manager
Managed
Cache
Storage
Data Service
Index Service
Query Service STORAGE
Couchbase Server 6
SHARD
7
SHARD
9
SHARD
5
SHARDSHARDSHARD
Managed
Cache
Cluster
Manager
Cluster
Manager
Managed
Cache
Storage
Data Service
Index Service
Query Service
©2014 Couchbase Inc.
Couchbase Server: Core concepts
 Node
 Cluster
 Bucket
 Views and Design Documents
 Key/Value
 Cluster Map
 “Smart” clients
 Multi-dimensional scaling (> 4.0)
9
Introducing N1QL
Just the basics…
©2014 Couchbase Inc.
Data In Couchbase
 Data is stored as a binary blob or a document
 Every datum has a primary key
 A document is a JSON object
 Documents are of arbitrary length and depth
 Documents contain scalars, other objects and arrays or
collections
 Each document has it’s own implied schema
 Documents are agile; they can evolve over time
©2014 Couchbase Inc.
N1QL and SQL differences
 Data model
 Static vs Fluid
 Data is constrained by a “key space”
 Projection differences
 Columns vs “rich model”
 Reshaping of data is possible
 Selection differences
 Table vs Keyspace
 New operators: “.” and “[]”
 Filtering differences
 Irregular shape: IS MISSING, IS NULL
 ANY, SOME, EVERY 12
©2014 Couchbase Inc.
Language Structure
 Statements
 Data Definition Language (DDL)
 Data Manipulations Language (DML)
 Query statements
 Expressions
 Comments
13
©2014 Couchbase Inc.
Queries and Results
 Submit queries using SELECT statements
 Nested subqueries are possible
 Query across multiple documents with JOINs
 Operators and function allow navigation through arrays
 Use predicates in theWHERE clause to return ill regular data
 GROUP BY, ORDER BY, LIMIT and OFFSET and functions to transform
results
 N1QL provide paths to support nested data
 Paths are used with arrays and nested objects to get attributes
 Array syntax is used to get the information: orders[0].product_id
14
©2014 Couchbase Inc.
Queries and Results: example
15
SELECT name, brewery_id from `beer-sample`
WHERE brewery_id IS NOT MISSING
LIMIT 2;
©2014 Couchbase Inc.
Query results
 Returned as a JSON document
 Results are nested within additional data
 Request Id
 Signature
 Status
 Metrics
 Errors messages are also returned with “hints”
16
©2014 Couchbase Inc.
Query Results: Example
17
{
"requestID": "fbea9e79-a2e2-4ab8-9fdc-14e098838cc1",
"signature": { "brewery_id": "json", "name": "json" },
"results": [
{ "brewery_id": "big_horn_brewing_the_ram_2", "name": "Schaumbergfest" },
{ "brewery_id": "ballast_point_brewing", "name": "Wahoo Wheat Beer" } ],
"status": "success",
"metrics": { "elapsedTime": "131.492184ms",
"executionTime": "131.261322ms",
"resultCount": 2,
"resultSize": 205 }
}
©2014 Couchbase Inc.
System Information
 N1QL has a system catalogue that stores metadata
 The system catalog is a namespace called “system”
 Each artifact has a keyspace
 Logical hierarchy
 Data stores
 Namespaces
 Keyspaces
 Indexes
 Duals
 All system keyspaces are queryable!
18
Advanced N1QLTopics
What you need to know…
©2014 Couchbase Inc.
NEST
©2014 Couchbase Inc.
UNNEST
21
©2014 Couchbase Inc.
Index Hints
22
©2014 Couchbase Inc.
EXPLAIN
23
©2014 Couchbase Inc.
Creating Indexes
24
REST API, SDK support, ODBC/JDBC and
Connectors
How to access it…
©2014 Couchbase Inc.
REST API
©2014 Couchbase Inc.
SDK Support
27
©2014 Couchbase Inc.
ODBC and JDBC Drivers
28
©2014 Couchbase Inc.
Connectors and 3rd part integration
29
Q&A
You ask, I answer…mmmaybe
Thank you.

More Related Content

PDF
A Thorough Comparison of Delta Lake, Iceberg and Hudi
PPTX
Big Data Day LA 2015 - NoSQL: Doing it wrong before getting it right by Lawre...
PDF
The Future of Hadoop by Arun Murthy, PMC Apache Hadoop & Cofounder Hortonworks
PPTX
Membase Meetup 2010
PDF
Spark meetup - Zoomdata Streaming
PDF
Big Data Day LA 2015 - Always-on Ingestion for Data at Scale by Arvind Prabha...
PDF
Presto @ Uber Hadoop summit2017
PPTX
Lambda-less Stream Processing @Scale in LinkedIn
A Thorough Comparison of Delta Lake, Iceberg and Hudi
Big Data Day LA 2015 - NoSQL: Doing it wrong before getting it right by Lawre...
The Future of Hadoop by Arun Murthy, PMC Apache Hadoop & Cofounder Hortonworks
Membase Meetup 2010
Spark meetup - Zoomdata Streaming
Big Data Day LA 2015 - Always-on Ingestion for Data at Scale by Arvind Prabha...
Presto @ Uber Hadoop summit2017
Lambda-less Stream Processing @Scale in LinkedIn

What's hot (20)

PDF
What database
PDF
Apache Spark Based Reliable Data Ingestion in Datalake with Gagan Agrawal
PDF
Big Data Day LA 2016/ Use Case Driven track - Hydrator: Open Source, Code-Fre...
PDF
Large Scale Lakehouse Implementation Using Structured Streaming
PDF
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
PPTX
Hadoop World 2011: Data Ingestion, Egression, and Preparation for Hadoop - Sa...
PDF
Designing and Implementing a Real-time Data Lake with Dynamically Changing Sc...
PDF
From Batch to Streaming ET(L) with Apache Apex
PDF
What's new in SQL on Hadoop and Beyond
PDF
Change Data Capture with Data Collector @OVH
PPTX
Presto: SQL-on-anything
PPTX
Reshape Data Lake (as of 2020.07)
PPTX
In Search of Database Nirvana: Challenges of Delivering HTAP
PDF
Streaming Data Lakes using Kafka Connect + Apache Hudi | Vinoth Chandar, Apac...
PDF
ETL Practices for Better or Worse
PDF
Database Camp 2016 @ United Nations, NYC - Michael Glukhovsky, Co-Founder, Re...
PPTX
Time-oriented event search. A new level of scale
PDF
Presto Strata London 2019: Cost-Based Optimizer for interactive SQL on anything
PPTX
What is Change Data Capture (CDC) and Why is it Important?
PDF
Big Telco - Yousun Jeong
What database
Apache Spark Based Reliable Data Ingestion in Datalake with Gagan Agrawal
Big Data Day LA 2016/ Use Case Driven track - Hydrator: Open Source, Code-Fre...
Large Scale Lakehouse Implementation Using Structured Streaming
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
Hadoop World 2011: Data Ingestion, Egression, and Preparation for Hadoop - Sa...
Designing and Implementing a Real-time Data Lake with Dynamically Changing Sc...
From Batch to Streaming ET(L) with Apache Apex
What's new in SQL on Hadoop and Beyond
Change Data Capture with Data Collector @OVH
Presto: SQL-on-anything
Reshape Data Lake (as of 2020.07)
In Search of Database Nirvana: Challenges of Delivering HTAP
Streaming Data Lakes using Kafka Connect + Apache Hudi | Vinoth Chandar, Apac...
ETL Practices for Better or Worse
Database Camp 2016 @ United Nations, NYC - Michael Glukhovsky, Co-Founder, Re...
Time-oriented event search. A new level of scale
Presto Strata London 2019: Cost-Based Optimizer for interactive SQL on anything
What is Change Data Capture (CDC) and Why is it Important?
Big Telco - Yousun Jeong
Ad

Viewers also liked (20)

PDF
Kiji cassandra la june 2014 - v02 clint-kelly
PPTX
La big datacamp2014_vikram_dixit
PPTX
Summit v4 dave wolcott
PPT
Big datacamp june14_alex_liu
PDF
Ag big datacampla-06-14-2014-ajay_gopal
PDF
Big Data Day LA 2015 - Solr Search with Spark for Big Data Analytics in Actio...
PDF
20140614 introduction to spark-ben white
PDF
140614 bigdatacamp-la-keynote-jon hsieh
PDF
Aziksa hadoop for buisness users2 santosh jha
PDF
Big Data Day LA 2015 - HBase at Factual: Real time and Batch Uses by Molly O'...
PDF
Yarn cloudera-kathleenting061414 kate-ting
PPTX
2014 bigdatacamp asya_kamsky
PDF
Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...
PDF
Hadoop and NoSQL joining forces by Dale Kim of MapR
PPTX
Hadoop Innovation Summit 2014
PPTX
Big Data Day LA 2015 - Deep Learning Human Vocalized Animal Sounds by Sabri S...
PPTX
Big Data Day LA 2016/ Data Science Track - Decision Making and Lambda Archite...
PDF
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Introduction to Kafka - Je...
PDF
Big Data Day LA 2016/ Big Data Track - Twitter Heron @ Scale - Karthik Ramasa...
PDF
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Alluxio (formerly Tachyon)...
Kiji cassandra la june 2014 - v02 clint-kelly
La big datacamp2014_vikram_dixit
Summit v4 dave wolcott
Big datacamp june14_alex_liu
Ag big datacampla-06-14-2014-ajay_gopal
Big Data Day LA 2015 - Solr Search with Spark for Big Data Analytics in Actio...
20140614 introduction to spark-ben white
140614 bigdatacamp-la-keynote-jon hsieh
Aziksa hadoop for buisness users2 santosh jha
Big Data Day LA 2015 - HBase at Factual: Real time and Batch Uses by Molly O'...
Yarn cloudera-kathleenting061414 kate-ting
2014 bigdatacamp asya_kamsky
Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...
Hadoop and NoSQL joining forces by Dale Kim of MapR
Hadoop Innovation Summit 2014
Big Data Day LA 2015 - Deep Learning Human Vocalized Animal Sounds by Sabri S...
Big Data Day LA 2016/ Data Science Track - Decision Making and Lambda Archite...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Introduction to Kafka - Je...
Big Data Day LA 2016/ Big Data Track - Twitter Heron @ Scale - Karthik Ramasa...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Alluxio (formerly Tachyon)...
Ad

Similar to Big Data Day LA 2015 - Introducing N1QL: SQL for Documents by Jeff Morris of Couchbase (20)

PPTX
Query in Couchbase. N1QL: SQL for JSON
PPTX
N1QL: What's new in Couchbase 5.0
PPTX
Couchbase Data Platform | Big Data Demystified
PPTX
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
PPTX
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
PDF
“N1QL” a Rich Query Language for Couchbase: Presented by Don Pinto, Couchbase
PDF
N1QL New Features in couchbase 7.0
PPTX
Enterprise Architect's view of Couchbase 4.0 with N1QL
PPTX
Querying NoSQL with SQL - MIGANG - July 2017
PPTX
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
PDF
NoSQL's biggest lie: SQL never went away - Martin Esmann
PPTX
Powering an API with GraphQL, Golang, and NoSQL
PPTX
Deep dive into N1QL: SQL for JSON: Internals and power features.
ODP
Couchbase - Introduction
PPTX
No sq ls-biggest-lie_sql-never-went-away_martin-esmann
PPTX
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
PPTX
Couchbase N1QL: Language & Architecture Overview.
PDF
Slides: NoSQL Data Modeling Using JSON Documents – A Practical Approach
PPTX
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
PPTX
Developing Applications with Go and NoSQL
Query in Couchbase. N1QL: SQL for JSON
N1QL: What's new in Couchbase 5.0
Couchbase Data Platform | Big Data Demystified
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
“N1QL” a Rich Query Language for Couchbase: Presented by Don Pinto, Couchbase
N1QL New Features in couchbase 7.0
Enterprise Architect's view of Couchbase 4.0 with N1QL
Querying NoSQL with SQL - MIGANG - July 2017
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
NoSQL's biggest lie: SQL never went away - Martin Esmann
Powering an API with GraphQL, Golang, and NoSQL
Deep dive into N1QL: SQL for JSON: Internals and power features.
Couchbase - Introduction
No sq ls-biggest-lie_sql-never-went-away_martin-esmann
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Couchbase N1QL: Language & Architecture Overview.
Slides: NoSQL Data Modeling Using JSON Documents – A Practical Approach
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
Developing Applications with Go and NoSQL

More from Data Con LA (20)

PPTX
Data Con LA 2022 Keynotes
PPTX
Data Con LA 2022 Keynotes
PDF
Data Con LA 2022 Keynote
PPTX
Data Con LA 2022 - Startup Showcase
PPTX
Data Con LA 2022 Keynote
PDF
Data Con LA 2022 - Using Google trends data to build product recommendations
PPTX
Data Con LA 2022 - AI Ethics
PDF
Data Con LA 2022 - Improving disaster response with machine learning
PDF
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
PDF
Data Con LA 2022 - Real world consumer segmentation
PPTX
Data Con LA 2022 - Modernizing Analytics & AI for today's needs: Intuit Turbo...
PPTX
Data Con LA 2022 - Moving Data at Scale to AWS
PDF
Data Con LA 2022 - Collaborative Data Exploration using Conversational AI
PDF
Data Con LA 2022 - Why Database Modernization Makes Your Data Decisions More ...
PDF
Data Con LA 2022 - Intro to Data Science
PDF
Data Con LA 2022 - How are NFTs and DeFi Changing Entertainment
PPTX
Data Con LA 2022 - Why Data Quality vigilance requires an End-to-End, Automat...
PPTX
Data Con LA 2022-Perfect Viral Ad prediction of Superbowl 2022 using Tease, T...
PPTX
Data Con LA 2022- Embedding medical journeys with machine learning to improve...
PPTX
Data Con LA 2022 - Data Streaming with Kafka
Data Con LA 2022 Keynotes
Data Con LA 2022 Keynotes
Data Con LA 2022 Keynote
Data Con LA 2022 - Startup Showcase
Data Con LA 2022 Keynote
Data Con LA 2022 - Using Google trends data to build product recommendations
Data Con LA 2022 - AI Ethics
Data Con LA 2022 - Improving disaster response with machine learning
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - Real world consumer segmentation
Data Con LA 2022 - Modernizing Analytics & AI for today's needs: Intuit Turbo...
Data Con LA 2022 - Moving Data at Scale to AWS
Data Con LA 2022 - Collaborative Data Exploration using Conversational AI
Data Con LA 2022 - Why Database Modernization Makes Your Data Decisions More ...
Data Con LA 2022 - Intro to Data Science
Data Con LA 2022 - How are NFTs and DeFi Changing Entertainment
Data Con LA 2022 - Why Data Quality vigilance requires an End-to-End, Automat...
Data Con LA 2022-Perfect Viral Ad prediction of Superbowl 2022 using Tease, T...
Data Con LA 2022- Embedding medical journeys with machine learning to improve...
Data Con LA 2022 - Data Streaming with Kafka

Recently uploaded (20)

PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
cuic standard and advanced reporting.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Empathic Computing: Creating Shared Understanding
PPT
Teaching material agriculture food technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
Encapsulation theory and applications.pdf
A comparative analysis of optical character recognition models for extracting...
20250228 LYD VKU AI Blended-Learning.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Mobile App Security Testing_ A Comprehensive Guide.pdf
Unlocking AI with Model Context Protocol (MCP)
Group 1 Presentation -Planning and Decision Making .pptx
Getting Started with Data Integration: FME Form 101
Spectral efficient network and resource selection model in 5G networks
SOPHOS-XG Firewall Administrator PPT.pptx
Network Security Unit 5.pdf for BCA BBA.
cuic standard and advanced reporting.pdf
Spectroscopy.pptx food analysis technology
Dropbox Q2 2025 Financial Results & Investor Presentation
Empathic Computing: Creating Shared Understanding
Teaching material agriculture food technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
1. Introduction to Computer Programming.pptx
Encapsulation theory and applications.pdf

Big Data Day LA 2015 - Introducing N1QL: SQL for Documents by Jeff Morris of Couchbase

  • 1. Bringing the SQL back to NoSQL Querying JSON w/N1QL
  • 2. ©2014 Couchbase Inc. Titanium Sponsors Platinum Sponsors Gold Sponsors
  • 3. ©2014 Couchbase Inc. About Me: Jeff Morris  Software Engineer @Couchbase  Maintain several open source projects…  Official Couchbase .NET SDK  Linq2Couchbase  CouchbaseASP.NET Extensions  Former Enterprise Architect  Work primarily with .NET, but some Java and arch. ex. with PHP  Family, Surfing and Fishing 3
  • 4. ©2014 Couchbase Inc. Agenda  Intro  Couchbase 101, Data in Couchbase  N1QL  N1QL vs SQL, Language Structure, Queries and Results  Advanced  How do queries work, 2i, Predicate filters  SDK Support  RESTAPI,Ad hoc queries, Linq, Java DSL  Q&A 4
  • 6. ©2014 Couchbase Inc. Couchbase Server: About  High throughput, low latency  Built-in distributed cache  Commodity hardware  Distributed, shared nothing architecture  Nodes are peers  Strong consistency  Elastic scalability  XDCR
  • 7. ©2014 Couchbase Inc. Storage Engine Cluster Manager Data Service Projector & Router New Services in Couchbase Server 4.0 Query ServiceIndex Service Supervisor Index maintenance & Scan coordinator Index#2Index#1 Query Processor cbq-engine Bucket#1 Bucket#2 DCP Stream Index#4Index#3 ... B u c k e t # 2 B u c k e t # 1 1809311211 18901 ManagedCache
  • 8. ©2014 Couchbase Inc. Full Cluster Architecture STORAGE Couchbase Server 1 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster Manager Cluster Manager Managed Cache Storage Data Service Index Service Query Service STORAGE Couchbase Server 2 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster Manager Cluster Manager Managed Cache Storage Data Service Index Service Query Service STORAGE Couchbase Server 3 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster Manager Cluster Manager Managed Cache Storage Data Service Index Service Query Service STORAGE Couchbase Server 4 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster Manager Cluster Manager Managed Cache Storage Data Service Index Service Query Service STORAGE Couchbase Server 5 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster Manager Cluster Manager Managed Cache Storage Data Service Index Service Query Service STORAGE Couchbase Server 6 SHARD 7 SHARD 9 SHARD 5 SHARDSHARDSHARD Managed Cache Cluster Manager Cluster Manager Managed Cache Storage Data Service Index Service Query Service
  • 9. ©2014 Couchbase Inc. Couchbase Server: Core concepts  Node  Cluster  Bucket  Views and Design Documents  Key/Value  Cluster Map  “Smart” clients  Multi-dimensional scaling (> 4.0) 9
  • 11. ©2014 Couchbase Inc. Data In Couchbase  Data is stored as a binary blob or a document  Every datum has a primary key  A document is a JSON object  Documents are of arbitrary length and depth  Documents contain scalars, other objects and arrays or collections  Each document has it’s own implied schema  Documents are agile; they can evolve over time
  • 12. ©2014 Couchbase Inc. N1QL and SQL differences  Data model  Static vs Fluid  Data is constrained by a “key space”  Projection differences  Columns vs “rich model”  Reshaping of data is possible  Selection differences  Table vs Keyspace  New operators: “.” and “[]”  Filtering differences  Irregular shape: IS MISSING, IS NULL  ANY, SOME, EVERY 12
  • 13. ©2014 Couchbase Inc. Language Structure  Statements  Data Definition Language (DDL)  Data Manipulations Language (DML)  Query statements  Expressions  Comments 13
  • 14. ©2014 Couchbase Inc. Queries and Results  Submit queries using SELECT statements  Nested subqueries are possible  Query across multiple documents with JOINs  Operators and function allow navigation through arrays  Use predicates in theWHERE clause to return ill regular data  GROUP BY, ORDER BY, LIMIT and OFFSET and functions to transform results  N1QL provide paths to support nested data  Paths are used with arrays and nested objects to get attributes  Array syntax is used to get the information: orders[0].product_id 14
  • 15. ©2014 Couchbase Inc. Queries and Results: example 15 SELECT name, brewery_id from `beer-sample` WHERE brewery_id IS NOT MISSING LIMIT 2;
  • 16. ©2014 Couchbase Inc. Query results  Returned as a JSON document  Results are nested within additional data  Request Id  Signature  Status  Metrics  Errors messages are also returned with “hints” 16
  • 17. ©2014 Couchbase Inc. Query Results: Example 17 { "requestID": "fbea9e79-a2e2-4ab8-9fdc-14e098838cc1", "signature": { "brewery_id": "json", "name": "json" }, "results": [ { "brewery_id": "big_horn_brewing_the_ram_2", "name": "Schaumbergfest" }, { "brewery_id": "ballast_point_brewing", "name": "Wahoo Wheat Beer" } ], "status": "success", "metrics": { "elapsedTime": "131.492184ms", "executionTime": "131.261322ms", "resultCount": 2, "resultSize": 205 } }
  • 18. ©2014 Couchbase Inc. System Information  N1QL has a system catalogue that stores metadata  The system catalog is a namespace called “system”  Each artifact has a keyspace  Logical hierarchy  Data stores  Namespaces  Keyspaces  Indexes  Duals  All system keyspaces are queryable! 18
  • 19. Advanced N1QLTopics What you need to know…
  • 25. REST API, SDK support, ODBC/JDBC and Connectors How to access it…
  • 28. ©2014 Couchbase Inc. ODBC and JDBC Drivers 28
  • 29. ©2014 Couchbase Inc. Connectors and 3rd part integration 29
  • 30. Q&A You ask, I answer…mmmaybe