the nosql landscape – document databases · 2018-06-26 · •the document model has benefits...
TRANSCRIPT
Technology Summit 30 June 2015, London
Innovation for growing your business
The NoSQL landscape –Document DatabasesStefan Wittmann – Product Manager
The NoSQL landscape
Database Landscape
Data Model Example Requirements Example Uses
Key-value and column Availability, scale and
speed
Big data capture, caching
Document Indexing ability and model
flexibility
Agile (mobile) app
development, mixed data
analytics
NewSQL Consistency Scaling out established
apps
Graph Articulated relationships Analyzing and supporting
social networks,
knowledge intensive
environments
• Proprietary Query Language (No SQL)
• No universal usage
Adoption Barriers
10.000.000
2.000
Our offering
• In addition to the data models we already support we are working
on even more data models:
– Key-Value
– Document
– Graph
Support for new data models
Focus: Document Data Model
• The document model has benefits suited for specific use cases
– Flexibility and Ease-of-Use
• Schemas don’t have to be defined upfront (or ever) and therefore
application developers can quickly setup work environments for their data
and easily adapt to changes in data structure.
– Sparseness
• Attributes with a particular key may appear in some documents within a
collection, but not in others.
– Hierarchical Data
• Structured types may be arrays or objects, nested arbitrarily deep. Data is
stored de-normalized in contrast to relational systems where data is stored
normalized.
– Dynamic Typing
• Values for a particular key have no fixed data type and may vary from
document to document.
Focus on Documents
• Built on two structures
• Collection of name/value pairs
• Ordered list of values
What is a document?
{
"Name" : "John Smith",
"address" : {
"streetAddress": "21 2nd Street",
"city" : "New York",
"state" : "NY",
"postalCode" : 10021
},
"phoneNumber" :
[
{ "type" : "home", "number": "212 555-1234" },
{ "type" : "fax", "number": "646 555-4567" }
]
}
JSON representation
What does a document look like?
Real World
Relational approach
{
„id“:1,
„type“:“meter“,
„timestamp“:“2015-01-01 15:03“
„details“:1
}
{
„id“:1,
„confidence“:3,
„status“:2,
„value“:12345
}
Document Model approach
{
„id“:1,
„type“:“meter“,
„timestamp“:“2015-01-01 15:03“
„details“: {
„confidence“:3,
„status“:2,
„value“:12345
}
}
• Java
• .NET
• Node.js
• COS
• REST
Client Drivers
• JavaScript Object Notation (popularly known as JSON)
[RFC4627] is becoming increasingly important in Web- and
Cloud-based communities for exchanging data between Web-
based applications. This has in turn led to the demands for
storage, retrieval, querying, and manipulation of JSON data in the
context of SQL It is important that SQL respond to these
requirements by providing appropriate extensions for
handling JSON data.
• The SQL/JSON proposals address this comment.
• http://jtc1bigdatasg.nist.gov/_workshop/08_SQL_Support_for_JSON_abstract.pdf
SQL Standard
• No proprietary query language
• We follow a SQL centric approach
– Very close to the draft of the SQL standard committee for JSON SQL
integration
– Set of functions to construct JSON
– Set of functions to query collections
Querying documents
• Construct JSON documents from SQL query results :
– JSON_OBJECT
– JSON_OBJECTAGG
– JSON_ARRAY
– JSON_ARRAYAGG
Publishing JSON
• This query returns one row for each department recorded in the
DEPTS table.
• That row contains a single column, which contains a serialization
of a JSON object having the department number and name.
SELECT
JSON_OBJECT( 'deptno' : deptno, 'deptname' : deptname )
FROM depts
{ "deptno" : 314,"deptname" : "Engineering" }
JSON_OBJECT
• This query returns a JSON object with key value pairs composed
from two columns.
• SELECT JSON_OBJECTAGG (deptname, deptno) FROM depts
• { "Engineering" : 314, "Architecture" : 113, "Accounting" : 12,
"Sales" : 7, "Executives" : 13 }
JSON_OBJECTAGG
• SQL built-in functions for querying JSON data
– JSON_TABLE: returns a SQL table
– JSON_QUERY: returns a SQL string value that corresponds to
a JSON object or a JSON array
– JSON_VALUE: returns a SQL scalar value
• New SQL predicates applicable on JSON data
– IS JSON
– JSON_EXISTS
Querying JSON data
SELECT TOP 10 Name, DOB
FROM JSON_TABLE(
‘People’,
‘{“columns”:
[
{“column”:”Name”,”path”:”$.Name”,”type”:”varchar(50)”},
{“column”:”DOB”,”path”:”$.DOB”,”type”:”DATE”}
]
}’)
ORDER BY Name DESC
Querying a collection
Name DOB
Zimmerman, Norbert Q. 06/02/1938
Yezek, Dave P. 09/16/2005
… …
The Real WorldWhy this matters
• Accept unplanned/unknown data
• Agile Development
• Handle sparse data efficiently
• Fluid data types
• Handle user-defined data
Use Cases
A sneak peek