SlideShare uma empresa Scribd logo
1 de 82
NoSQL's biggest lie: SQL never went away!
Martin Esmann
Developer Advocate, Couchbase
1
Let’s do something unspectacular
2
©2014 Couchbase Inc.
A query
3
SELECT * FROM `travel-sample`
WHERE type = ‘airline’
AND country = ‘United Kingdom’;
©2014 Couchbase Inc.
A query
4
Did I say unspectacular?
5
©2014 Couchbase Inc.
That was JSON
6
So, what did we do?
7
©2014 Couchbase Inc.
We put the SQL back into NoSQL
8
But first, let’s take a step back
9
©2014 Couchbase Inc.
NoSQL?
10
Polyglot persistence is “…using multiple data
storage technologies, chosen based upon the
way data is being used by individual
applications. Why store binary images in
relational database, when there are better
storage systems?”
Martin Fowler and Pramod Sadalage
©2014 Couchbase Inc.
Types of NoSQL database
11
By Schumi4ever (Own work) [CC BY-SA 3.0
(http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons
©2014 Couchbase Inc.
Key value
12
Email: martin@couchbase.comemail:email: {
“personal”: “martin.esmann@hotmail.com”,
“work”: “martin@couchbase.com”
}
©2014 Couchbase Inc.
London
matthew@couchbase.com
james@couchbase.com
laura@couchbase.com
tom@couchbase.com
david@couchbase.com
greg@couchbase.com
Document
13
Developer Advocacy
matthew@couchbase.com
james@couchbase.com
laura@couchbase.com
laurent@couchbase.com
martin@couchbase.com
matt@couchbase.com
nic@couchbase.com
will@couchbase.com
martin@couchbase.com:
{
"city": ”Copenhagen",
"glasses": false,
"team": "Developer Advocacy",
"music": ”Electronic!"
}
©2014 Couchbase Inc.
Document
14
London
matthew@couchbase.com
james@couchbase.com
laura@couchbase.com
Developer Advocacy
matthew@couchbase.com
james@couchbase.com
laura@couchbase.com
London and Developer Advocacy
matthew@couchbase.com
james@couchbase.com
laura@couchbase.com
©2014 Couchbase Inc.
And the others
15
Context is all
16
©2014 Couchbase Inc.
There's always a trade-off
17
• Offload from some other data store (i.e. caching)
• Computation offload
• Speed
• Scalability
• Availability
• Flexibility in what you store
• Query flexibility
Where Couchbase comes in
18
©2014 Couchbase Inc.
Couchbase Server 4.0
19
High availability
cache
Key-value
store
Document
database N1QL SQL-like query
for JSON
N1QL: SQL for JSON
20
©2014 Couchbase Inc.
A user profile as JSON
21
How do we query that?
22
©2014 Couchbase Inc.
Querying the JSON profile
23
• Look-up documents: i.e. manual secondary indexing (2i)
• Couchbase views: i.e. automated secondary indexing (2i)
• N1QL
©2014 Couchbase Inc.
Manual 2i
24
©2014 Couchbase Inc.
Automatic 2i: views
25
©2014 Couchbase Inc.
N1QL
26
©2014 Couchbase Inc.
SELECT
27
SELECT ...
©2014 Couchbase Inc.
SELECT
28
SELECT 1 + 1;
{
"requestID": "3ccebac7-341a-4c31-a2c5-b46aaed54356",
"signature": {
"$1": "number"
},
"results": [
{ "$1": 2
}
],
"status": "success",
"metrics": {
"elapsedTime": "31.826219ms",
"executionTime": "29.800616ms",
"resultCount": 1,
"resultSize": 31
}
}
©2014 Couchbase Inc.
SELECT COUNT
29
SELECT COUNT(*) FROM `default`
WHERE office = "London";
{
"requestID": "6e733000-ac83-44ba-95a7-9b012e9c553d",
"signature": {
"$1": "number"
},
"results": [
{
"$1": 6
}
],
"status": "success",
"metrics": {
"elapsedTime": "18.603124ms",
"executionTime": "18.327696ms",
"resultCount": 1,
"resultSize": 31
}
}
©2014 Couchbase Inc.
SELECT email FROM `default`
WHERE office = "London";
SELECT
30
©2014 Couchbase Inc.
SELECT email FROM `default`
WHERE office = "London"
AND team = "Developer Advocacy";
SELECT
31
©2014 Couchbase Inc.
SELECT email FROM `default`
WHERE office = "London"
AND team != "Developer Advocacy";
SELECT
32
But this is JSON
33
©2014 Couchbase Inc.
SELECT conferences[0].name
AS event_name FROM `default`;
ARRAY ELEMENTS
34
©2014 Couchbase Inc.
SELECT DISTINCT
conferences[0].name
AS event_name FROM `default`;
DISTINCT ARRAY ELEMENTS
35
©2014 Couchbase Inc.
SELECT DISTINCT
conferences[0].name
AS event_name FROM `default`
WHERE conferences
IS NOT MISSING;
REMOVE MISSING ITEMS
36
©2014 Couchbase Inc.
SELECT email AS person,
conferences[0].name AS event
FROM `default`
WHERE ANY event in conferences
SATISFIES event.name =
"Droidcon Sweden" END;
WHO IS GOING TO DROIDCON SWEDEN?
37
What's going on underneath?
38
©2014 Couchbase Inc.
EXPLAIN SELECT email AS person,
conferences[0].name AS event
FROM `default`
WHERE ANY event in conferences
SATISFIES event.name =
"Droidcon Sweden" END;
EXPLAIN
39
Is N1QL read-only?
40
©2014 Couchbase Inc.
Updating and deleting
41
• DELETE: provide the key to delete the document
• INSERT: provide a key and some JSON to create a new document
• UPSERT: as INSERT but will overwrite existing docs
• UPDATE: change individual values inside existing docs
©2014 Couchbase Inc.
UPDATE
42
©2014 Couchbase Inc.
DELETE
43
A larger data-set: travel-sample
44
©2014 Couchbase Inc.
TRAVEL SAMPLE DATA
45
©2014 Couchbase Inc.
travel-sample
46
©2014 Couchbase Inc.
CREATE PRIMARY INDEX
47
CREATE PRIMARY INDEX
ON `travel-sample`
USING GSI;
©2014 Couchbase Inc.
SELECT
48
SELECT * FROM `travel-sample`
WHERE type = "airline";
©2014 Couchbase Inc.
SELECT
49
©2014 Couchbase Inc.
SELECT
50
SELECT * FROM `travel-sample`
WHERE type = "airline"
AND country = "United States";
©2014 Couchbase Inc.
SELECT
51
Indexes
52
©2014 Couchbase Inc.
CREATE INDEX
53
CREATE INDEX airline
ON `travel-sample`(type)
WHERE type = "airline"
USING GSI;
JOINs
54
©2014 Couchbase Inc.
JOINs
55
• Retrieve data from two documents in a single SELECT
• Join within a keyspace/bucket
• Join across keyspaces/buckets
©2014 Couchbase Inc.
A SIMPLE JOIN
56
SELECT * FROM `travel-sample` r
JOIN `travel-sample` a
ON KEYS r.airlineid
WHERE r.sourceairport="LHR"
AND r.destinationairport = "SFO";
©2014 Couchbase Inc.
WHO FLIES LHR->SFO?
57
SELECT DISTINCT a.name FROM
`travel-sample` r
JOIN `travel-sample` a
ON KEYS r.airlineid
WHERE r.sourceairport="LHR"
AND r.destinationairport = "SFO";
©2014 Couchbase Inc.
UNNEST
58
• Breaks out nested JSON from the results
©2014 Couchbase Inc.
SOMETHING USEFUL
59
SELECT a.name, s.flight, s.utc, r.sourceairport,
r.destinationairport, r.equipment
FROM `travel-sample` r
UNNEST r.schedule s
JOIN `travel-sample` a
ON KEYS r.airlineid
WHERE r.sourceairport="LHR"
AND r.destinationairport = "SFO"
AND s.day=1
ORDER BY s.utc;
N1QL vs View’s
60
©2014 Couchbase Inc.
N1QL and views
61
N1QL Views
Ad-hoc querying Predictable queries
JSON in and JSON out Number crunching
Large growth clusters Multi-dimensional/geospatial
queries
Multi-dimensional scaling
62
©2014 Couchbase Inc.
Scaling out
63
Horizontal scaling
Partitions a dataset onto one or more homogenous nodes
Each node runs the same mixed workloads
Re-partition dataset with additional hardware capacity
©2014 Couchbase Inc.
What is Multi-Dimensional Scalability?
MDS is the architecture that enables independent scaling of data, query, and
indexing workloads.
Multi-dimensional scaling
64
©2014 Couchbase Inc.
Multi-dimensional scaling
65
Isolated Service for minimized interference
Independent “zones” for query, index, and data services
Minimize indexing and query overhead on core key-value
operations.
©2014 Couchbase Inc.
Multi-dimensional scaling
66
Independent scalability for the best computational capacity
per service
Heavier indexing (index more fields):
scale up index service nodes.
More RAM for query processing:
scale up query service nodes.
Geospatial querying
67
©2014 Couchbase Inc.
Geospatial views
68
• Experimental in 3.0, now GA in 4.0
• Performance and stability improvements
• GeoJSON output
• Bounding-box and range queries on
multiple dimensions
What else is in Couchbase Server 4.0?
69
©2014 Couchbase Inc.
Other new things in Couchbase Server 4.0
70
• ForestDB: GSIs are stored with a new storage engine
• Filtered XDCR: more efficient cross-data centre replication
• Security: LDAP, admin auditing
Developers?
SDK support for N1QL!
71
©2014 Couchbase Inc.
.NET SDK: Connection
72
// Option 1: Create Cluster and open bucket
var cluster = new Cluster(config);
var bucket = cluster.OpenBucket(bucketName);
// Option 2: ClusterHelper and open bucket (Singleton, thread safe bucket instance
ClusterHelper.Initialize(config);
var cluster = ClusterHelper.Get();
var bucket = ClusterHelper.GetBucket(bucketName);
// Close connection
cluster.CloseBucket(bucket);
cluster.Dispose();
©2014 Couchbase Inc.
.NET SDK: Client Configuration
73
// Cluster Configuration
var config = new ClientConfiguration
{
Servers = new List<Uri> { new Uri("http://10.211.55.2:8091/pools"),},
UseSsl = false,
BucketConfigs = new Dictionary<string, BucketConfiguration>
{
{
"travel-sample",
new BucketConfiguration
{
BucketName = "travel-sample",
UseSsl = false,
Password = "",
PoolConfiguration = new PoolConfiguration
{
MaxSize = 10,
MinSize = 5
}
}
}
}
};
©2014 Couchbase Inc.
.NET SDK: Basic Operations
74
// Create document (dynamic)
var doc = new Document<dynamic>
{
Id = "doc1",
Content = new
{
Id = "doc1",
Title = "My Document",
Type = "basic",
Pages = 3
}
};
// update or create document
var upsertResult = await bucket.UpsertAsync<dynamic>(doc);
// Get document
var getResult = bucket.GetDocument<dynamic>("key1");
// Delete document
var deleteResult = await bucket.RemoveAsync<dynamic>(doc);
// Check if doc/key exsists
var exsists = await bucket.ExistsAsync("key1");
©2014 Couchbase Inc.
.NET SDK: N1QL Query (raw)
75
// Create Query Request. Raw API request
var query = QueryRequest.Create("SELECT COUNT(*) FROM `travel-sample` WHERE type = 'airline'");
// Execute Query.
var response = await bucket.QueryAsync<dynamic>(query);
// Convert result to string for easy console print out.
var result = JsonConvert.SerializeObject(response, Formatting.Indented);
©2014 Couchbase Inc.
.NET SDK: N1QL Query (Linq2Couchbase)
76
// Lambda syntax
var result = ClusterHelper.GetBucket("beer-sample")
.Queryable<Beer>()
.Where(a => a.Type == "beer")
.Select(a => a)
.Join(
ClusterHelper.GetBucket("beer-sample")
.Queryable<Brewery>()
.Where(airline => airline.Type == "brewery"),
innerKey => innerKey.BreweryId,
outerKey => N1Ql.Key( outerKey),
(inner,outer) => new { Inner = inner, Outer = outer})
.Take(1)
.ToList();
©2014 Couchbase Inc.
.NET SDK: N1QL Query (Linq2Couchbase)
77
// Query syntax
var query =
from beer in QueryFactory.Queryable<Beer>(mockBucket.Object)
join breweryGroup in QueryFactory.Queryable<Brewery>(mockBucket.Object)
on beer.BreweryId equals N1Ql.Key(breweryGroup) into bg
from brewery in bg.DefaultIfEmpty()
select new { beer.Name, beer.Abv, BreweryName = brewery.Name };
https://github.com/couchbaselabs/N1QL-Intro-dotNET-
Supplement-Demo-code
Next Steps
Couchbase Developer Portal
developer.couchbase.com
80
Forums
http://forums.couchbase.com
81
Thanks for listening!

Mais conteúdo relacionado

Mais procurados

Taming the Cloud Database with Apache jclouds
Taming the Cloud Database with Apache jcloudsTaming the Cloud Database with Apache jclouds
Taming the Cloud Database with Apache jclouds
zshoylev
 

Mais procurados (20)

Cassandra EU - Data model on fire
Cassandra EU - Data model on fireCassandra EU - Data model on fire
Cassandra EU - Data model on fire
 
Os Davis
Os DavisOs Davis
Os Davis
 
Compliance as Code with terraform-compliance
Compliance as Code with terraform-complianceCompliance as Code with terraform-compliance
Compliance as Code with terraform-compliance
 
Introduction To Terraform
Introduction To TerraformIntroduction To Terraform
Introduction To Terraform
 
Infraestrutura Imutável na AWS usando Packer, Ansible, CloudFormation e Kuber...
Infraestrutura Imutável na AWS usando Packer, Ansible, CloudFormation e Kuber...Infraestrutura Imutável na AWS usando Packer, Ansible, CloudFormation e Kuber...
Infraestrutura Imutável na AWS usando Packer, Ansible, CloudFormation e Kuber...
 
Intro to Terraform
Intro to TerraformIntro to Terraform
Intro to Terraform
 
Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013
Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013
Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013
 
開放運算&GPU技術研究班
開放運算&GPU技術研究班開放運算&GPU技術研究班
開放運算&GPU技術研究班
 
Dive into DevOps | March, Building with Terraform, Volodymyr Tsap
Dive into DevOps | March, Building with Terraform, Volodymyr TsapDive into DevOps | March, Building with Terraform, Volodymyr Tsap
Dive into DevOps | March, Building with Terraform, Volodymyr Tsap
 
Zookeeper In Action
Zookeeper In ActionZookeeper In Action
Zookeeper In Action
 
Taming the Cloud Database with Apache jclouds
Taming the Cloud Database with Apache jcloudsTaming the Cloud Database with Apache jclouds
Taming the Cloud Database with Apache jclouds
 
Living the Nomadic life - Nic Jackson
Living the Nomadic life - Nic JacksonLiving the Nomadic life - Nic Jackson
Living the Nomadic life - Nic Jackson
 
Vielseitiges In-Memory Computing mit Apache Ignite und Kubernetes
Vielseitiges In-Memory Computing mit Apache Ignite und KubernetesVielseitiges In-Memory Computing mit Apache Ignite und Kubernetes
Vielseitiges In-Memory Computing mit Apache Ignite und Kubernetes
 
Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2
 
ARC204 AWS Infrastructure Automation - AWS re: Invent 2012
ARC204 AWS Infrastructure Automation - AWS re: Invent 2012ARC204 AWS Infrastructure Automation - AWS re: Invent 2012
ARC204 AWS Infrastructure Automation - AWS re: Invent 2012
 
Enrique lima azure-it-pro-ps
Enrique lima azure-it-pro-psEnrique lima azure-it-pro-ps
Enrique lima azure-it-pro-ps
 
DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...
DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...
DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...
 
Powershell for Log Analysis and Data Crunching
 Powershell for Log Analysis and Data Crunching Powershell for Log Analysis and Data Crunching
Powershell for Log Analysis and Data Crunching
 
Apache Zookeeper
Apache ZookeeperApache Zookeeper
Apache Zookeeper
 
Elasticsearch - Dynamic Nodes
Elasticsearch - Dynamic NodesElasticsearch - Dynamic Nodes
Elasticsearch - Dynamic Nodes
 

Destaque

Conventions of a digipak
Conventions of a digipakConventions of a digipak
Conventions of a digipak
Madzipan
 
Fichamento do livro "A linguagem no teatro infantil" de Marco Camarotti
Fichamento do livro "A linguagem no teatro infantil" de Marco CamarottiFichamento do livro "A linguagem no teatro infantil" de Marco Camarotti
Fichamento do livro "A linguagem no teatro infantil" de Marco Camarotti
Rafaella Cavalcante
 
ANALYSIS OF EIA FOR AN ENERGY PROJECT - ASSIGNMENT
ANALYSIS OF EIA FOR AN ENERGY PROJECT - ASSIGNMENTANALYSIS OF EIA FOR AN ENERGY PROJECT - ASSIGNMENT
ANALYSIS OF EIA FOR AN ENERGY PROJECT - ASSIGNMENT
Doug Robertson
 

Destaque (17)

Conventions of a digipak
Conventions of a digipakConventions of a digipak
Conventions of a digipak
 
Susan rep SS 2014
Susan rep SS 2014Susan rep SS 2014
Susan rep SS 2014
 
Susan Rep FW 2013
Susan Rep FW 2013Susan Rep FW 2013
Susan Rep FW 2013
 
CONTENT - Dreamteam 2016
CONTENT - Dreamteam 2016CONTENT - Dreamteam 2016
CONTENT - Dreamteam 2016
 
Bonamassa New York Lookbook SS 2012
Bonamassa New York Lookbook SS 2012 Bonamassa New York Lookbook SS 2012
Bonamassa New York Lookbook SS 2012
 
La España actual (1975-2004)
La España actual (1975-2004)La España actual (1975-2004)
La España actual (1975-2004)
 
Cambios climáticos (análisis)
Cambios climáticos (análisis)Cambios climáticos (análisis)
Cambios climáticos (análisis)
 
Brightcove Video SEO - Optimizing Brightcove Video for Search
Brightcove Video SEO - Optimizing Brightcove Video for SearchBrightcove Video SEO - Optimizing Brightcove Video for Search
Brightcove Video SEO - Optimizing Brightcove Video for Search
 
Franquismo1957 69
Franquismo1957 69Franquismo1957 69
Franquismo1957 69
 
Fichamento do livro "A linguagem no teatro infantil" de Marco Camarotti
Fichamento do livro "A linguagem no teatro infantil" de Marco CamarottiFichamento do livro "A linguagem no teatro infantil" de Marco Camarotti
Fichamento do livro "A linguagem no teatro infantil" de Marco Camarotti
 
Ejemplo de un plan de negocios de un restaurante
Ejemplo de un plan de negocios de un restauranteEjemplo de un plan de negocios de un restaurante
Ejemplo de un plan de negocios de un restaurante
 
Transicion española
Transicion españolaTransicion española
Transicion española
 
Cartões e diferenciação de preços: argumentos e contra-argumentos
Cartões e diferenciação de preços: argumentos e contra-argumentosCartões e diferenciação de preços: argumentos e contra-argumentos
Cartões e diferenciação de preços: argumentos e contra-argumentos
 
A experiência do Cliente em lojas de varejo e supermercados
A experiência do Cliente em lojas de varejo e supermercadosA experiência do Cliente em lojas de varejo e supermercados
A experiência do Cliente em lojas de varejo e supermercados
 
ANALYSIS OF EIA FOR AN ENERGY PROJECT - ASSIGNMENT
ANALYSIS OF EIA FOR AN ENERGY PROJECT - ASSIGNMENTANALYSIS OF EIA FOR AN ENERGY PROJECT - ASSIGNMENT
ANALYSIS OF EIA FOR AN ENERGY PROJECT - ASSIGNMENT
 
Supportive Periodontal Therapy
Supportive Periodontal TherapySupportive Periodontal Therapy
Supportive Periodontal Therapy
 
alaacv
alaacvalaacv
alaacv
 

Semelhante a No sq ls-biggest-lie_sql-never-went-away_martin-esmann

Get started with Microsoft SQL Polybase
Get started with Microsoft SQL PolybaseGet started with Microsoft SQL Polybase
Get started with Microsoft SQL Polybase
Henk van der Valk
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpreso
ke4qqq
 

Semelhante a No sq ls-biggest-lie_sql-never-went-away_martin-esmann (20)

NoSQL’s biggest secret: NoSQL never went away
NoSQL’s biggest secret: NoSQL never went awayNoSQL’s biggest secret: NoSQL never went away
NoSQL’s biggest secret: NoSQL never went away
 
Simplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring CloudSimplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring Cloud
 
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
 
Standardized API Development using Node.js
Standardized API Development using Node.jsStandardized API Development using Node.js
Standardized API Development using Node.js
 
Quick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase ServerQuick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase Server
 
N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.
 
Managing a SolrCloud cluster using APIs
Managing a SolrCloud cluster using APIsManaging a SolrCloud cluster using APIs
Managing a SolrCloud cluster using APIs
 
Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...
Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...
Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...
 
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
 
Everything you wanted to know about Trove but didn't know whom to ask!
Everything you wanted to know about Trove but didn't know whom to ask!Everything you wanted to know about Trove but didn't know whom to ask!
Everything you wanted to know about Trove but didn't know whom to ask!
 
Pyrax talk
Pyrax talkPyrax talk
Pyrax talk
 
Conceptos básicos. Seminario web 5: Introducción a Aggregation Framework
Conceptos básicos. Seminario web 5: Introducción a Aggregation FrameworkConceptos básicos. Seminario web 5: Introducción a Aggregation Framework
Conceptos básicos. Seminario web 5: Introducción a Aggregation Framework
 
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data... Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 
Going native with Apache Cassandra
Going native with Apache CassandraGoing native with Apache Cassandra
Going native with Apache Cassandra
 
(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++
 
Get started with Microsoft SQL Polybase
Get started with Microsoft SQL PolybaseGet started with Microsoft SQL Polybase
Get started with Microsoft SQL Polybase
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
 
Redshift Introduction
Redshift IntroductionRedshift Introduction
Redshift Introduction
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpreso
 
Building a Dev/Test Cloud with Apache CloudStack
Building a Dev/Test Cloud with Apache CloudStackBuilding a Dev/Test Cloud with Apache CloudStack
Building a Dev/Test Cloud with Apache CloudStack
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

No sq ls-biggest-lie_sql-never-went-away_martin-esmann

Notas do Editor

  1. That is Jason Statham. 
  2. The shape of our data and our use of that data determines the way that we store and query it. This part is basically a plea for people to choose the right database for the job and to choose Couchbase on its terms: i.e. you need to think outside the confines of your experience and preferred tools and rather think about what you're trying to achieve and which trade-offs you're willing to make in order to achieve it.
  3. The shape of our data and our use of that data determines the way that we store and query it. NoSQL is many things: my toaster is NoSQL.
  4. KV doesn't care what the V is. The V is opaque to the DB. Try to show it can be anything.
  5. Document has some insight into the document. It could be deeper indexing of the document, it could be query.
  6. Show that you can run an index across the documents and end up with a compound index of people in a city who are also in a particular team.
  7. Column databases are great for time series. Graph databases are a fancy query engine on top of something else.
  8. Describe the NoSQL space a bit. Talk about the importance of trade-offs in choosing a non-relational database and how your judgement of the importance of those trade-offs can only come from the circumstances of your use case.
  9. The data model is only part of the story. Our intention for the data, and how we plan to query that data, completes the story.
  10. JSON simplifies that. Talk about Martin Fowler's idea of aggregate-oriented database. "Store together the data that you access together". So, the data is now easier to distribute across a cluster but how do we query it?
  11. Actually, mostly it's KV and we're just looking for different ways of indexing what we're accessing. N1QL is a game changer.
  12. Manual 2i is fine enough but takes more work on the application side. Gives you the advantage of strong consistency.
  13. Views let us automate that. View ain't going nowhere. Views might be the right way to index some stuff. Ultimately you're still doing KV but the indexes are slightly out of sync. Still, you're telling Couchbase how to go about giving you the data you want.
  14. N1QL changes all that. With N1QL you tell Couchbase what you want and it worries about the detail of how to get it. We're leaving KV behind entirely here. Importantly, the results you get back no longer have to match the exact documents stored in the database. You can use N1QL to get the data you want, rather than having to mangle all that on the application side.
  15. SELECT is the workhorse of N1QL. This is where you'll most likely spend your time.
  16. With N1Ql everything you get back is JSON. It gives you a bunch of metadata around the result itself to help you know how to handle the result or the error.
  17. Let's try to replicate that index of people in Couchbase's London office. First, let's count them.
  18. Let's get the email addresses for everyone in the London office.
  19. And now, just everyone in London who is in the Developer Advocacy team.
  20. Equally, we can find the Londoners who *aren't* in the DA team.
  21. Okay, so far so SQL. We have a JSON database here, though, so how do we dive into that JSON?
  22. In our small data set we have an array for some people that shows which conferences they're attending. We know the name of the array – conferences – and we can go down into the array by specifing the layer at which we'll find the sub-key. In our results here we get back all the conferences people are attending. We also get back some blanks because this is a schema unenforced database. N1QL copes gracefully with missing data because real world data is messy.
  23. We don't want our results to be messy, though. So let's strip out some of that duplication but requesting DISTINCT conference names. We're still get that blank result but only once this time. We don't really want that in our results as what we want is a list of conferences.
  24. N1QL gives us the MISSING command. We can use IS NOT MISSING to make sure that what we get back are the conference names from only the documents that have a conference name.
  25. Now, let's plan our trip to Droidcon Sweden. Again, we can dive into nested data in our JSON to look for the conference name. Here we can use N1QL's SATISFIES to find the conference name inside the conferences array.
  26. It's good to know what's going on underneath. EXPLAIN lets us see into the query engine and how it is getting back the data we're looking for. Particularly useful for when results aren't as expected.
  27. Okay, so we had a little fun but what about something more realistic? CB 4.0 comes with the travel-sample data set. Let's have a place.
  28. Okay, so we had a little fun but what about something more realistic? CB 4.0 comes with the travel-sample data set. Let's have a place.
  29. It gives us airports, airlines, routes and that translates into flights.
  30. We're dealing with almost 32k records, so it's a chunkier data set to play with.
  31. Talk about indexing. Touch on GSI and views. Every bucket needs one index. Why do we make you create a PRIMARY index? Why isn't it there by default? Well, it takes resource to make and maintain the index. If you don't want N1QL, we don't want to waste your resources by creating an index you don't need.
  32. Let's try something simple.
  33. We get back 187 airlines and it took us nearly half a second.
  34. It might be more useful to narrow our focus. let's find airlines from the US.
  35. It's still taking us a good half second to get a result back. If we did an EXPLAIN now we'd see that we're doing a full scan of the bucket. Couchbase is going through each of the 32k docs and checking each one to see if it has type=airline and country=United States. That's why it's taking a long time.
  36. Indexes are not just for the primary key. We can create secondary indexes on the data. Here we're creating an index of all the airlines, using CB 4.0's new GSI indexing.
  37. N1QL is all about giving you the data you want, not the data that happens to be in the database. JOINs are an essential part of that.
  38. Using the travel sample data we can find flights from LHR to SFO. Explain that we're aliasing travel-sample twice, because both sides of the join are in the same bucket. It's important not to conflate buckets and tables. Run this in cbq as it's too much for a GIF.
  39. Just as before, we’re getting a lot of repetition so let's get DISTINCT airline names back.
  40. UNNEST lets us promote nested data to the top level of our results and make use of it in refining our query.
  41. Here we use UNNEST and an inner join to find a list of all the flights from heathrow to SFO ordered by time. We are now aliasing the UNNESTed data too so we can easily use its data in our results.
  42. As we touched on earlier, there are now two indexing methods in Couchbase 4.0: views and GSI. Explain the relative merits of both and when you'd use which. Favour GSI for N1QL.
  43. 31: Break
  44. 31: Break