SlideShare une entreprise Scribd logo
1  sur  91
Télécharger pour lire hors ligne
NoSQL DEEP DIVE
Relational + JSON = Simply Powerful
Jef Treece, IBM Product Manager jtreece@us.ibm.com
John F. Miller III, IBM Software Architect miller3@us.ibm.com
Keshava Murthy, IBM Software Architect rkeshav@us.ibm.com

© 2013 IBM Corporation
Agenda

NoSQL Business Drivers
Live Demo
JSON Store Overview
Relational + JSON = Simply Powerful

2
NoSQL BUSINESS DRIVERS
Jef Treece, IBM Product Manager
jtreece@us.ibm.com
@JefTreece

© 2013 IBM
Corporation
What is Driving IT Demand?
Advanced predictive
analytics

Cyber
security

Infrastructure
optimization –
cloud computing

Explosion of
mobile devices

Business
optimization
+
big data

Real-time
sensor data

Growth of
social media
Business Trends Driving NoSQL Adoption
●

Applications must support mobile
–
–

●

Interoperate with modern applications with agility
Enterprise infrastructure

Ability to scale to big data
–
–

Use case are driving big data

–
●

Commodity hardware and software

Data in motion

Strategy: more interactions with customers
–

Systems of engagement needed!

–

71% CIOs see move toward social/digital collaboration

–

New class of applications are based on NoSQL
Global C-suite Study, http://www-935.ibm.com/services/us/en/c-suite/csuitestudy2013/

Explosion of mobile
devices
NoSQL Landscape

Key Value Store
● Couchbase
● Riak
● Citrusleaf
● Redis
● BerkeleyDB
● Membrain
● ...

Martin Fowler says:
“aggregate-oriented”
What you're most likely to
access as a unit.

Document
● MongoDB
● CouchDB
● RavenDB
● Couchbase
● ...

Column
● Cloudera
● HBase
● Hypertable
● Cassandra
● ...

Graph
● OrientDB
● DEX
● Neo4j
● GraphBase
● ...
Characteristics of a NoSQL Document Store
●

Ability to manage humongous data

●

Enable rapid development
–
–

●

Flexible schema development
Tap into the existing ecosystem – JSON, BSON, drivers, developers,
modern applications

Capture real-time interactions
–

Varied data sources
JavaScript Everywhere
●

JavaScript client development now dominant
–
–

●

JavaScript and HTML5 for browser presentation
JavaScript mobile applications

JSON: JavaScript Object Notation
–

End-to-end JavaScript

–

The language of the web

JS

JS

JS

JS
JS
Traditional Relational Database Still Required
●

Relational model works best for transactional data

●

Enterprise data exists in relational databases

●

Relational database preferred for most analytics

You need both
at the same time!
0

NoSQL + Relational
Explosion of mobile
devices – gaming
and social apps

E-commerce, social
commerce

Smart
Devices

Advertising:
serving ads and
real-time bidding

Internet of
Things

Machine data and
real-time operational
decisions

Social networking,
online communities
Business Value of NoSQL + RDBMS
●

Level 1: Hybrid storage
–

JSON and relational tables in same storage engine

–

Different apps, same database
Reduces cost and complexity!
Performance!

●

Level 2: Hybrid applications
–

A single application brings together RDBMS and NoSQL

–

Business insight from bringing the two different types of data and
the two different requirements together
New business patterns!
IBM/MongoDB Partnership
MongoDB and IBM announced a partnership in June 2013

OS
BSON L

JSON Query
C
JSON Ecosystem

12
Enter IBM Informix 12.10
Simply powerful
for both!

●

Now you have the right tool for the job – all in one toolbox
–

System of record: Informix RDBMS

–

System of engagement: Informix NoSQL

–

Hybrid storage, hybrid applications
Thank You!

Next Up...
Demo
John F. Miller III, IBM Software Architect
miller3@us.ibm.com
BUILDING A REAL LIFE
APPLICATION
IOD Attendee Photo Application
Allow conference attendee to take and share photo!
Technology Highlights
•

Create a hybrid application using NoSQL, traditional SQL,
timeseries mobile web application
•

Utilizing both JSON collections, SQL tables and timeseries

•

Utilize IBM Dojo Mobile tools to build a mobile application

•

Leverage new mongo client side drivers for fast application
development and delployment

•

Demonstrate scale-out using sharding with over 100 nodes

•

Cloud based solution using Amazon Cloud
•

•

Can be deployed on PureFlex or SoftLayer

Provide real-time analytics on all forms of data
•

Leverage existing popular analytic front-end IBM-Congos

•

Utilize an in-memory columnar database accelerator to provide realtime trending analytics on data
Mobile Device Application Architecture

Apache Web Server
IOD Photo App - UPLOAD

Photo Application
IBM Dojo Mobile
Informix
tag

Van Gogh

Photo
collection

Informix
JSON
Listener User

Table
Photo Application Schema
TimeSeries
NoSQL Collections
activity_photos

activity_data

timeseries(photo_like)
Application Considerations

Photo meta-data varies from camera to camera
A Picture and all its meta data are stored in-document
Pictures are stored in a JSON collection
Pre-processing on the phone ensures only reasonable size
photos are sent over the network.
Example of Live JSON Photo Data
JSON Data

{"_id":ObjectId("526157c8112c2fe70cc06a75"), "Make":"NIKON CORPORA
TION","Model":"NIKON D60","Orientation":"1","XResolution":"300","
YResolution":"300","ResolutionUnit":"2","Software":"Ver.1.00 ","D
ateTime":"2013:05:15 19:46:36","YCbCrPositioning":"2","ExifIFDPoi
nter":"216","ExposureTime":"0.005","FNumber":"7.1","ExposureProgr
am":"Not defined","ISOSpeedRatings":"100",
"Contrast":"Normal","Saturation":"Normal","Sharpness":"Normal",
"SubjectDistanceRange":"Unknown","name":"DSC_0078.JPG","img_d
ata":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABcQ
Motivation of Sharding
Enables horizontal scaling (partitioning)
The application strategy in step with business
−

Start small and grow with commodity hardware
as the business grows

−

Grow as you go

Economics of solution
−
−

8

4 nodes each of 4 cores
1 node of 16 cores
Code Snippets
Used PHP and mongo PHP API
Example showing
−

Inserting

−

Retrieving data

−

Deleting JSON documents and
SQL rows

−

Executing Stored Procedures
Basic PHP Programming Overview Information
List of NoSQL collection names and SQL tables names
Function to set the active database and return the Collection

private $conn;
private
private
private
private
private
private
private

$dbname = "photo_demo";
$photoCollectionName = "photos";
$contactsCollectionName = "contacts";
$sqlCollectionName = 'system.sql';
$userTableName = "users";
$tagsTableName = "tags";
$likesTableName = "likes";

private $photoQueryProjection = array("_id" => 1, "tags" => 1,
"user_id" => 1, "img_data" => 1);
/**
* Get collection by name
* @param MongoCollection $collectionName
*/
private function getCollection($collectionName) {
return $this->conn->selectDB($this->dbname)->selectCollection ($collectionName);
}
Insert Example

Information is placed
in the contacts
collection
Insert Data into a Collection
Very simple to insert JSON data into a collection using the
MongoAPIs

/**
* Insert user's contact information into contacts table.
*/
public function insertContact( $json ) {
if (! is_array ( $json )) {
return "Contact info not in JSON format.";
}
try {
$result=$this->getCollection($this->contactsCollectionName)->insert($json);
if ($result ["ok"] != 1) {
return $result ["err"];
}
} catch ( MongoException $e ) {
return $e->getMessage ();
}
return "ok";
}
Retrieve Collection Information
Very simple to retrieve data from a collection using the
MongoAPIs
Data is returned as a JSON document

/**
* Get all contact info
*/
public function adminContacts() {
$contactsCollection = $this->getCollection($this>contactsCollectionName);
$cursor = $contactsCollection->find();
$results = $this->getQueryResults($cursor);
return $results;
}
Naughty Pictures

Allow users to flag naughty
pictures
Have naughty pictures
automatically removed
Delete a Photo and its Information
Deleting from SQL Tables and NoSQL Collection is exactly
the same
/**
* Delete photo
*/
public function deletePhoto($id) {
try {
// First delete from likes and tags tables
$query = array('photo_id' => $id['_id']);
$result = $this->getCollection($this->likesTableName)->remove($query);
if ($result ["ok"] != 1) {
return $result["err"];
}
$result = $this->getCollection($this->tagsTableName)->remove($query);
if ($result ["ok"] != 1) {
return $result["err"];
}
// Then delete the photo from the collection
$query = array('_id' => new MongoId($id['_id']));
$result = $this->getCollection ( $this->photoCollectionName )->remove ( $query );
if ($result ["ok"] != 1) {
return $result["err"];
}
} catch ( MongoException $e ) {
return $e->getMessage();
}
return "ok";
}
Executing a Stored Procedure in MongoAPI

/**
* Get the user_id for a particular user name (email address).
*
* Calls a stored procedure that will insert into the users table if the
* user does not exist yet and returns the user_id.
*
* @param string $username
* @return int $user_id
*/
public function getUserId($username) {
$username = trim($username);
try {
$sql = "EXECUTE FUNCTION getUserID('" . $username . "')";
$result = $this->getCollection($this->sqlCollectionName)->findOne(array('$sql'=>$sql));
if (isset($result['errmsg'])) {
return "ERROR. " . $result['errmsg'];
}
return $result['user_id'];
} catch (MongoException $e) {
return "ERROR. " . $e->getMessage();
}
}
Real Time Analytics
Customer Issues
−

Several different models of data (SQL, NoSQL,
TimeSeries/Sensor)

−

NoSQL is not strong building relations between collections

−

Most valuable analytics combine the results of all data models

−

Most prominent analytic system written using standard SQL

−

ETL & YAS (Yet Another System)

Solution
Provide a mapping of the required data in SQL form
−

Enables common tools like Cognos
Analytics on a Hybrid Database

Photo
collection

SQL

MongoAPI

Informix

User
Table
Photo Application
SQL Mapping of NoSQL PHOTO Collection

activity_photos

activity_data

timeseries(photo_like)
Mapping A Collection To A SQL Table

CREATE VIEW photo_metadata (gpslatitude, gpslongitude,
make, model, orientation, datetimeoriginal,
exposuretime, fnumber, isospeedratings,
pixelxdimension, pixelydimension)
AS SELECT BSON_VALUE_LVARCHAR ( x0.data , 'GPSLatitude' ),
BSON_VALUE_LVARCHAR ( x0.data , 'GPSLongitude' ),
BSON_VALUE_LVARCHAR ( x0.data , 'Make' ),
BSON_VALUE_LVARCHAR ( x0.data , 'Model' ),
BSON_VALUE_LVARCHAR ( x0.data , 'Orientation' ),
BSON_VALUE_LVARCHAR ( x0.data , 'DateTimeOriginal' ) ,
BSON_VALUE_LVARCHAR ( x0.data , 'ExposureTime'),
BSON_VALUE_LVARCHAR ( x0.data , 'FNumber' ),
BSON_VALUE_LVARCHAR ( x0.data , 'ISOSpeedRatings' ),
BSON_VALUE_LVARCHAR ( x0.data , 'PixelXDimension' ) ,
BSON_VALUE_LVARCHAR ( x0.data , 'PixelYDimension')
FROM photos x0;
Configure Informix on Amazon Cloud Simple

•
•
•
•
•

Instantiate the Amazon image
Setup the storage
Install the product
Start the system
Configure sharding
NOSQL, JSON AND BSON
OVERVIEW
Technical Opportunities/ Motivation
What are NoSQL Databases?
Quick overview of JSON
What is sharding?
New Era in Application Requirements
Store data from web/mobile application in their
native form
−

New web applications use JSON for storing and
exchanging information

−

Very lightweight – write more efficient applications

−

It is also the preferred data format for mobile
application back-ends

Move from development to production in no
time!
−

Ability to create and deploy flexible JSON schema

−

Gives power to application developers by reducing
dependency on IT
Ideal for agile, rapid development and continuous
integration

25
What is a NoSQL Document Store?
Not Only SQL or NOt allowing SQL
A non-relational database management systems
−

Flexible schema

−

Avoids join operations

−

Scales horizontally

−

Eventually consistent (no ACID)

Good with distributing data and fast application development

Provides a mechanism for storage and retrieval of
data while providing horizontal scaling.

26
IBM Use Case Characteristics for JSON

27
Example of Supported JSON Types
There are 6 types of
JSON Values
Example of each JSON
type
Mongo-specific JSON
types in blue
– date

28

{
"string":"John",
"number":123.45,
"boolean":true,
"array":[ "a", "b", "c" ],
"object: { "str":"Miller", "num":711 },
"value": NULL,
"date": ISODate("2013-10-01T00:33:14.000Z")
}
The Power of JSON Drives Flexible Schema
JSON key value pair enables a flexible schema
Flexible schema simplifies deployment of
new/upgraded applications
Fast/Agile application development
−

Minimal to no schema management

Adept at variable attribute management
−

Easy to add new parts or objects

No transformation of data to match schema

29
Basic Translation Terms/Concepts

{"name":"John","age":21}
{"name":"Tim","age":28}
{"name":"Scott","age":30}

Collection

30

Value

John

21
28

Scott
Document

Age

Tim
Key

Name

30
Simple Code Example
use mydb
db.posts.insert( ‘{“author”:”John”, “date”,”2013-04-20”,”post”,”mypost ”}’ )

Creates the database “mydb” if it does not exists
Creates the collection “posts” if the it does not exists
Insert a record into a blog post by user John

db.posts.find ( ‘{ “author”:”John” }’ )

Retrieve all posts by user John

31
Dynamic Elasticity
Rapid horizontal scalability
−

Ability for the application to grow by adding low cost hardware
to the solution

−

Ability to add or delete nodes dynamically

−

Ability rebalance the data dynamically

Application transparent elasticity

32
Difference between Sharding Data VS Replication
Shard Key
state= “CA”

Shard Key
state= “WA”

Sharding
Each node holds a
portion of the data
• Hash
• Expression

33

Same data on
each node

Inserted data is
placed on the
correct node

Shard Key
state= “OR”

Replication

Data is copied to
all nodes

Operations are
shipped to
applicable nodes

Work on local copy
and modification
are propagated
NEW INFORMIX NOSQL/JSON
CAPABILITIES

34
IBM Informix High Level Solution

35
Two New Data Types JSON and BSON
Native JSON and BSON data types
Index support for NoSQL data types
Native operators and comparator functions
allow for direct manipulation of the BSON
data type
Database Server seamlessly converts to
and from

JSON
BSON
Character data

36

JSON
Informix JSON Store Benefits
Informix provides
−

Row locking on the individual JSON document
MongoDB locks the database

−

Large documents, up to 2GB maximum size
MongoDB limit is 16MB

−

Ability to compress documents
MongoDB currently not available

−

Ability to intelligently cache commonly used documents
MongoDB currently not available

37
Flexible Schema
Applications use JSON, a set of key-value pairs
JSON is text , BSON is the binary representation.
The explicit key-value pairs within the JSON/BSON
document will be roughly equivalent to columns in
relational tables.
Applications typically denormalize the schema
−

38

Customer, customer address, customer contacts all in a single JSON
Flexible Schema
However, there are differences!
−
−
−
−
−
−

39

The type of the Key Value data encoded within BSON is determined by the
client
Server is unaware of data type of each Key Value pair at table definition
time.
No guarantees that data type for each key will remain consistent in the
collection.
The keys in the BSON document can be arbitrary
While customers exploit flexible schema, they’re unlikely to create a single
collection and dump everything under the sun into that collection.
Developers typically denormalize the tables (a JSON document will
contain customer+customer addr + customer demographics +
) to avoid
joins.
Indexing
• Supports B-Tree indexes on any key-value pairs.
• Typed indices could be on simple basic type (int, decimal,)
• Type-less indices could be created on BSON and use BSON
type comparison
• Informix translates ensureIndex() to CREATE INDEX
• Informix translates dropIndex() to DROP INDEX
Mongo Operation
db.customers.ensureIndex(
{orderDate:1, zip:-1})

CREATE INDEX IF NOT EXISTS v_customer_2 ON
customer (bson_extract(data,‘orderDate')
ASC, bson_extract(data,‘zip') DESC) USING
BSON

db.customers.ensureIndex(
{orderDate:1},{unique:true})
40

SQL Operation

CREATE UNIQUE INDEX IF NOT EXISTS
v_customer_3 ON customer
(bson_extract(data,'c1') ASC USING BSON
Scaling Out Using Sharded Queries
Shard Key
state= “CA”

Shard Key
state= “WA”

Find sold cars for
all states

1. Request data from local shard
2. Automatically sends request to
other shards requesting data
3. Returns results to client
Shard Key
state= “OR”

41
41
Scaling Out Using Sharded Inserts
Shard Key
state= “CA”

Shard Key
state= “WA”

Row
state = “OR”

1. Insert row sent to your local
shard
2. Automatically forward the data to
the proper shard

Shard Key
state= “OR”
42
42
Scaling Out Adding a Shard
Shard Key
state= “CA”

Shard Key
state= “WA”

Command
Add Shard “NV”

1. Send command to local node
2. New shard dynamically added,
data re-distributed (if required)
Shard Key
state= “OR”
43

Shard Key
state= “NV”
Sharding with Hash

Hash based sharding simplifies the
partitioning of data across the shards
Benefits
−

No data layout planning is required

−

Adding additional nodes is online and
dynamic

Cons
−

Adding additional node requires data to be
moved

Data automatically broken in pieces

44
Mongo API Command to add a shard in Informix
Add just a single shard
db.runCommand({"addShard":"hostname1:port1"})

Add multi shard in a single command
−

Informix only syntax

db.runCommand({"addShard":["hostname2:port2", "hostname3:port3",
"hostname4:port4"]})

Shard the table phot_demo.photos by hash
sh.shardCollection("photo_demo.photos", {"_id": "hashed"})
Difference between Sharding Data VS Replication
Shard Key
state= “CA”

Shard Key
state= “WA”

Sharding
Each node holds a
portion of the data
• Hash
• Expression

46

Same data on
each node

Inserted data is
placed on the
correct node

Shard Key
state= “OR”

Replication

Data is copied to
all nodes

Operations are
shipped to
applicable nodes

Work on local copy
and modification
are propagated
Sharding is not for Data Availability
Sharding is for growth, not availability
Redundancy of a node provides high availability for the data
−

Both Mongo and Informix allow for multiple redundant nodes

−

Mongo refers to this as Replica Sets and the additional nodes
slaves

−

Informix refers to this as H/A, and additional secondary nodes

Term

Description

Informix Term

Shard

A single node or a group of nodes holding the same data
(replica set)

Instance

Replica Set

A collection of nodes contain the same data

HA Cluster

Shard Key

The field that dictates the distribution of the documents.
Must always exist in a document.

Shard Key

Sharded
Cluster

A group shards were each shard contains a portion of the Grid/Region
data.

Slave

A server which contains a second copy of the data for
read only processing.

47

HA Secondary Server
Informix Secondary Servers
Features of Informix secondary server:
−

Provide high availability
Can have one or more secondary servers
Synchronous or asynchronous secondary servers
Automatic promotion upon server failure

−

Scale out
Execute select
Allow Insert/Update/Deletes on the secondary servers
Secondary server can have their own disk or share disks with
the master node

−

48

Connection manager routes users connection based on policies
and server availability
Informix NoSQL Cluster Architecture Overview
three independent copies of
the data, but four servers
to share the workload (two
servers share the same
disk). Read/Write activity
supported on all servers

Shard Key
state= “CA”

Shard Key
state= “OR”

49

Shard Key
state= “WA”

© 2013 IBM Corporation
High Level Solution

50
Ability for All Clients to Access All Data Models

Informix SQLI
Drivers
IBM DRDA
Drivers
MongoDB Drivers

Traditional SQL

NoSQL - JSON
TimeSeries
MQ Series

51
Application Development Tools

The MEAN Stack
Client Applications
Applications
MongoDB
native Client

New Wire Protocol Listener supports
existing MongoDB drivers
Connect to MongoDB or Informix with same
application!

MongoDB
driver

MongoDB
Wire
Protocol
IBM
JDBC
NoSQL
Driver
Wire
Protocol
Listener

MongoDB
web browser

Informix
DB

Mobile

53
MongoDB Application Driver Compatibly
Ability to use any of the MongoDB client drivers and
frameworks against the Informix Database Server
−

Little to no change required when running MongoDB programs

−

Informix listens on the same default port as mongo, no need to
change.

Leverage the different programming languages available
All Support Languages
C

Perl

C#

PHP

Erland

Python

Java

Ruby

JavaScript

Scala

Node.js

Other Community Drivers are also available
54
High Level Solution

55
Hybrid Access between Relational & JSON Collections

Relational Table

SQL API

Standard ODBC, JDBC,
.NET, OData, etc.
Language SQL.

MongoDB API
(NoSQL)

?

JSON Collections

?
Mongo APIs for Java,
Javascript, C++, C#,...
Why do you need hybrid access?
Benefits of Simply Powerful

Access consistent data from its source
Avoid ETL, continuous data sync and conflicts.
Exploit the power of SQL, MongoAPI seamlessly
Exploit the power of RDBMS technologies in MongoAPI:
−
−
−

Informix Warehouse accelerator (Blu technologies)
Cost based Optimizer
R-tree indices for spatial, Lucene text indexes, and more.

Access all your data thru any interface: MongoAPI or SQL.
Store data in one place and efficiently transform and use
them on demand.
Existing SQL based tools and APIs can access new data in
JSON
Hybrid Access between Relational & JSON Collections

Relational Table

SQL API

MongoDB API
(NoSQL)

Standard ODBC, JDBC,
.NET, OData, etc.
Language SQL.

Mongo APIs for Java,
Javascript, C++, C#,...

JSON Collections

Direct SQL Access.
Dynamic Views
Row types

Mongo APIs for Java,
Javascript, C++, C#,...
Ability for All Clients to Access All Data Models

Informix SQLI
Drivers
IBM DRDA
Drivers
MongoDB Drivers

Traditional SQL

NoSQL - JSON
TimeSeries
MQ Series

60
Hybrid access: From MongoAPI to relational tables.

You want to develop an application with MongoAPI, but
1. You already have relational tables with data.
2. You have views on relational data
3. You need to join tables
4. You need queries with complex expressions. E.g. OLAP window
functions.
5. You need multi-statement transactions
6. You need to exploit stored procedure
7. You need federated access to other data
8. You have timeseries data.
MongoAPI Accessing Both NoSQL and Relational Tables
Mongo Application
JSON

JSON
Informix

IBM Wire Listener
db.customer.find({state:”MO”})

db.partners.find({state:”CA”})

Access JSON

Access Relational

SELECT bson_new(bson, ‘{}’) FROM customer
WHERE bson_value_lvarchar(bson,‘state’)=“MO”

JSON Collections

Customer

Tables

Relational Tables

IDXs

SELECT * FROM partners WHERE state=“CA”

IDXs

partners

Tables

Enterprise replication + Flexible Grid + Sharding

Distributed
Queries

Logs
How to Convert Relational Data as JSON Documents
Relational data can be treated as structured JSON documents;
column name-value becomes key-value pair.
SELECT partner, pnum, country from partners;
partner
pnum Country
Pronto
1748 Australia
Kazer
1746 USA
Diester
1472 Spain
Consultix 1742 France
{parnter:
{parnter:
{parnter:
{parnter:

“Pronot”, pnum:”1748”, Country: “Australia”}
“Kazar”, pnum:”1746”, Country: “USA”}
“Diester”, pnum:”1472”, Country: “Spain”}
“Consultix”, pnum:”1742”, Country: “France”}

Informix automatically translates the results of a relational query to
JSON/BSON form.
MongoAPI Accessing Both NoSQL and Relational Tables
•

Typically NoSQL does not involve transactions
•
•

•

In many cases, a document update is atomic, but not the application
statement
Example
•
7 targeted for deletion, but only 4 are removed

Informix-NoSQL provides transactions on all application
statements
•
•

Each server operation INSERT, UPDATE, DELETE, SELECT will
automatically be committed after each operation.
In Informix there is away to create multi-statement transactions is to
utilize a stored procedure

•

Default isolation level is DIRTY READ

•

All standard isolation level support
Accessing Data in Relational Tables
CREATE TABLE partners(pnum int, name varchar(32),
country varchar(32) );

db.partners.find({name:”Acme”}, {pnum:1, country:1});
SELECT pnum, country FROM partners WHERE name = “Acme”;

db.partners.find({name:”Acme”},
{pnum:1, country:1}).sort({b:1})
SELECT pnum,country FROM partners
WHERE name=“Acme” ORDER BY b ASC
Accessing data in relational tables.
db.partners.save({pnum:1632,name:”EuroTop”,Country:“Belgium”});
INSERT into partners(pnum, name, country) values
(1632, ”EuroTop”, “Belgium”);

db.partners.update({country:”Holland”},
{$set:{country:”Netherland”}}, {multi: true});
UPDATE partners SET country = “Netherland”
WHERE country = “Holland”;

db.partners.delete({name:”Artics”});
DELETE FROM PARTNERS WHERE name = “Artics”;
Views and Joins
Create a view between the existing partner table and a new
pcontact table
create table pcontact(pnum int, name varchar(32), phone
varchar(32));
insert into pcontact values(1748,"Joe Smith","61-123-4821");

create view partnerphone(pname, pcontact, pphone) as select a.name,
b.name, b.phone FROM pcontact b left outer join partners a on
(a.pnum = b.pnum);

Run the query across the view
db.partnerphone.find({pname:"Pronto"})
{ "pname":"Pronto", "pcontact":"Joe Smith", "pphone":"61-123-4821"}
Seamless federated access
1.
2.

create database newdb2;
create synonym oldcontactreport for
newdb:contactreport;

> use newdb2
> db.oldcontactreport.find({pname:"Pronto"})
{ "pname" : "Pronto", "pcontact" : "Joel Garner", "totalcontacts" : 2 }
{ "pname" : "Pronto", "pcontact" : "Joe Smith", "totalcontacts" : 2 }
SELECT data FROM oldcontactreport WHERE
bson_extract(data, 'pname') = “Pronto”;
•

create synonym oldcontactreport for
custdb@nydb:contactreport;
Get results from a stored procedure.
create function "keshav".p6() returns int, varchar(32);
define x int; define y varchar(32);
foreach cursor for select tabid, tabname into x,y from systables
return x,y with resume;
end foreach;
end procedure;
create view "keshav".v6 (c1,c2) as
select x0.c1 ,x0.c2 from table(function p6())x0(c1,c2);

db.v6.find().limit(5)
{
{
{
{
{

"c1"
"c1"
"c1"
"c1"
"c1"

:
:
:
:
:

1,
2,
3,
4,
5,

"c2"
"c2"
"c2"
"c2"
"c2"

:
:
:
:
:

"systables" }
"syscolumns" }
"sysindices" }
"systabauth" }
"syscolauth" }
Access Timeseries data
create table daily_stocks
( stock_id integer, stock_name lvarchar,
stock_data timeseries(stock_bar) );
-- Create virtual relational table on top (view)
EXECUTE PROCEDURE TSCreateVirtualTab('daily_stocks_virt',
'daily_stocks', 'calendar(daycal),origin(2011-01-03
00:00:00.00000)' );
create table daily_stocks_virt
( stock_id integer,
stock_name lvarchar,
timestamp datetime year to fraction(5),
high smallfloat,
low smallfloat,
final smallfloat,
vol smallfloat );
Access Timeseries data
db.daily_stocks_virt.find({stock_name:"IBM"})
{ "stock_id" : 901, "stock_name" : "IBM", "timestamp" : ISODate("2011-01-03T06:0
0:00Z"), "high" : 356, "low" : 310, "final" : 340, "vol" : 999 }
{ "stock_id" : 901, "stock_name" : "IBM", "timestamp" : ISODate("2011-01-04T06:0
0:00Z"), "high" : 156, "low" : 110, "final" : 140, "vol" : 111 }
{ "stock_id" : 901, "stock_name" : "IBM", "timestamp" : ISODate("2011-01-06T06:0
0:00Z"), "high" : 99, "low" : 54, "final" : 66, "vol" : 888 }
You want to perform complex analytics on JSON data
BI Tools like Cognos, Tableau generate SQL on data sources.
Option 1: Do ETL
Need to expose JSON data as views so it’s seen as a database
object.
−

We use implicit casting to convert to compatible types

−

The references to non-existent key-value pair returns NULL

Create any combination of views
−

A view per JSON collection

−

Multiple views per JSON collection

−

Views joining JSON collections, relational tables and views.

Use these database objects to create reports, graphs, etc.
Analytics
SQL & BI Applications
ODBC, JDBC connections

Informix
JSON Collections
Customer

Tables & views

Tables

Orders

Relational Tables

partners
Inventory
Tables
CRM

Tables
Benefits of Hybrid Power
Access consistent data from its source
Avoid ETL, continuous data sync and conflicts.
Exploit the power of SQL, MongoAPI seamlessly
Exploit the power of RDBMS technologies in MongoAPI:

− Informix Warehouse accelerator,
− Cost based Optimizer & power of SQL
− R-tree indices for spatial, Lucene text indexes, and more.
Access all your data thru any interface: MongoAPI & SQL
Store data in one place and efficiently transform and use
them on demand.
Existing SQL based tools and APIs can access new data
in JSON
The Hybrid Solution
Informix has the Best of Both Worlds
Relational and non-relational data in one system
NoSQL/MongoDB Apps can access Informix Relational Tables
Distributed Queries
Multi-statement Transactions
Enterprise Proven Reliability
Enterprise Scalability
Enterprise Level Availability

Informix provides the capability to leverage
the abilities of both relational DBMS and document store systems.

75
Informix Specific Advantages with Mongo Drivers
Traditional SQL tables and JSON collections co-existing in the
same database
Using the MongoDB client drivers Query, insert, update, delete
−

JSON collections

−

Traditional SQL tables

−

Timeseries data

Join SQL tables to JSON collections utilizing indexes
Execute business logic in stored procedures
Provide a view of JSON collections as a SQL table
−

Allows existing SQL tools to access JSON data

Enterprise level functionality
76
Questions

Contenu connexe

Tendances

Integration intervention: Get your apps and data up to speed
Integration intervention: Get your apps and data up to speedIntegration intervention: Get your apps and data up to speed
Integration intervention: Get your apps and data up to speedKenneth Peeples
 
Geospatial Ontologies and GeoSPARQL Services
Geospatial Ontologies and GeoSPARQL ServicesGeospatial Ontologies and GeoSPARQL Services
Geospatial Ontologies and GeoSPARQL ServicesStephane Fellah
 
xRM - as an Evolution of CRM
xRM - as an Evolution of CRMxRM - as an Evolution of CRM
xRM - as an Evolution of CRMCatherine Eibner
 
Keynote- SOA & Beyond : Future Computing
Keynote- SOA & Beyond : Future ComputingKeynote- SOA & Beyond : Future Computing
Keynote- SOA & Beyond : Future ComputingWSO2
 
DB Luminous... Know Your Data
DB Luminous... Know Your DataDB Luminous... Know Your Data
DB Luminous... Know Your DataRuss Pierce
 
Big data insights with Red Hat JBoss Data Virtualization
Big data insights with Red Hat JBoss Data VirtualizationBig data insights with Red Hat JBoss Data Virtualization
Big data insights with Red Hat JBoss Data VirtualizationKenneth Peeples
 
The Perfect Storm: The Impact of Analytics, Big Data and Analytics
The Perfect Storm: The Impact of Analytics, Big Data and AnalyticsThe Perfect Storm: The Impact of Analytics, Big Data and Analytics
The Perfect Storm: The Impact of Analytics, Big Data and AnalyticsInside Analysis
 
D365 Finance & Operations - Data & Analytics (see newer release of this docum...
D365 Finance & Operations - Data & Analytics (see newer release of this docum...D365 Finance & Operations - Data & Analytics (see newer release of this docum...
D365 Finance & Operations - Data & Analytics (see newer release of this docum...Gina Pabalan
 
Introduction to Big Data An analogy between Sugar Cane & Big Data
Introduction to Big Data An analogy  between Sugar Cane & Big DataIntroduction to Big Data An analogy  between Sugar Cane & Big Data
Introduction to Big Data An analogy between Sugar Cane & Big DataJean-Marc Desvaux
 
Enabling Mainframe Assets for API Economy with z?OS Connect EE
Enabling Mainframe Assets for API Economy with z?OS Connect EEEnabling Mainframe Assets for API Economy with z?OS Connect EE
Enabling Mainframe Assets for API Economy with z?OS Connect EEKatarzyna Wanat
 
Red Hat JBoss Data Virtualization
Red Hat JBoss Data VirtualizationRed Hat JBoss Data Virtualization
Red Hat JBoss Data VirtualizationDLT Solutions
 
Elastic Caching for a Smarter Planet - Make Every Transaction Count
Elastic Caching for a Smarter Planet - Make Every Transaction CountElastic Caching for a Smarter Planet - Make Every Transaction Count
Elastic Caching for a Smarter Planet - Make Every Transaction CountYakura Coffee
 
Virtual Directory
Virtual DirectoryVirtual Directory
Virtual Directorypankaj009
 

Tendances (20)

Integration intervention: Get your apps and data up to speed
Integration intervention: Get your apps and data up to speedIntegration intervention: Get your apps and data up to speed
Integration intervention: Get your apps and data up to speed
 
Introduction to integration
Introduction to integrationIntroduction to integration
Introduction to integration
 
Geospatial Ontologies and GeoSPARQL Services
Geospatial Ontologies and GeoSPARQL ServicesGeospatial Ontologies and GeoSPARQL Services
Geospatial Ontologies and GeoSPARQL Services
 
dvprimer-architecture
dvprimer-architecturedvprimer-architecture
dvprimer-architecture
 
xRM - as an Evolution of CRM
xRM - as an Evolution of CRMxRM - as an Evolution of CRM
xRM - as an Evolution of CRM
 
Keynote- SOA & Beyond : Future Computing
Keynote- SOA & Beyond : Future ComputingKeynote- SOA & Beyond : Future Computing
Keynote- SOA & Beyond : Future Computing
 
Cloud & The Mobile Stack
Cloud & The Mobile StackCloud & The Mobile Stack
Cloud & The Mobile Stack
 
DB Luminous... Know Your Data
DB Luminous... Know Your DataDB Luminous... Know Your Data
DB Luminous... Know Your Data
 
Big data insights with Red Hat JBoss Data Virtualization
Big data insights with Red Hat JBoss Data VirtualizationBig data insights with Red Hat JBoss Data Virtualization
Big data insights with Red Hat JBoss Data Virtualization
 
The Perfect Storm: The Impact of Analytics, Big Data and Analytics
The Perfect Storm: The Impact of Analytics, Big Data and AnalyticsThe Perfect Storm: The Impact of Analytics, Big Data and Analytics
The Perfect Storm: The Impact of Analytics, Big Data and Analytics
 
JDV Big Data Webinar v2
JDV Big Data Webinar v2JDV Big Data Webinar v2
JDV Big Data Webinar v2
 
Mobile datebase tool
Mobile datebase toolMobile datebase tool
Mobile datebase tool
 
D365 Finance & Operations - Data & Analytics (see newer release of this docum...
D365 Finance & Operations - Data & Analytics (see newer release of this docum...D365 Finance & Operations - Data & Analytics (see newer release of this docum...
D365 Finance & Operations - Data & Analytics (see newer release of this docum...
 
Introduction to Big Data An analogy between Sugar Cane & Big Data
Introduction to Big Data An analogy  between Sugar Cane & Big DataIntroduction to Big Data An analogy  between Sugar Cane & Big Data
Introduction to Big Data An analogy between Sugar Cane & Big Data
 
SOA Case Study
SOA Case StudySOA Case Study
SOA Case Study
 
Enabling Mainframe Assets for API Economy with z?OS Connect EE
Enabling Mainframe Assets for API Economy with z?OS Connect EEEnabling Mainframe Assets for API Economy with z?OS Connect EE
Enabling Mainframe Assets for API Economy with z?OS Connect EE
 
Red Hat JBoss Data Virtualization
Red Hat JBoss Data VirtualizationRed Hat JBoss Data Virtualization
Red Hat JBoss Data Virtualization
 
Elastic Caching for a Smarter Planet - Make Every Transaction Count
Elastic Caching for a Smarter Planet - Make Every Transaction CountElastic Caching for a Smarter Planet - Make Every Transaction Count
Elastic Caching for a Smarter Planet - Make Every Transaction Count
 
Datapower Steven Cawn
Datapower Steven CawnDatapower Steven Cawn
Datapower Steven Cawn
 
Virtual Directory
Virtual DirectoryVirtual Directory
Virtual Directory
 

Similaire à NoSQL Deepdive - with Informix NoSQL. IOD 2013

Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsclimboid
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchMongoDB
 
Tutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchTutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchMongoDB
 
CQRS and Event Sourcing with MongoDB and PHP
CQRS and Event Sourcing with MongoDB and PHPCQRS and Event Sourcing with MongoDB and PHP
CQRS and Event Sourcing with MongoDB and PHPDavide Bellettini
 
You know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on InformixYou know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on InformixKeshav Murthy
 
Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkImam Raza
 
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...Infinum
 
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB StitchMongoDB
 
MongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB
 
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy NguyenGrokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy NguyenHuy Nguyen
 
New Opportunities for Connected Data - Emil Eifrem @ GraphConnect Boston + Ch...
New Opportunities for Connected Data - Emil Eifrem @ GraphConnect Boston + Ch...New Opportunities for Connected Data - Emil Eifrem @ GraphConnect Boston + Ch...
New Opportunities for Connected Data - Emil Eifrem @ GraphConnect Boston + Ch...Neo4j
 
Microsoft Entity Framework
Microsoft Entity FrameworkMicrosoft Entity Framework
Microsoft Entity FrameworkMahmoud Tolba
 
Daniel Egan Msdn Tech Days Oc
Daniel Egan Msdn Tech Days OcDaniel Egan Msdn Tech Days Oc
Daniel Egan Msdn Tech Days OcDaniel Egan
 
Postgres Conf Keynote: What got you here WILL get you there
Postgres Conf Keynote: What got you here WILL get you therePostgres Conf Keynote: What got you here WILL get you there
Postgres Conf Keynote: What got you here WILL get you thereAnant Jhingran
 
Redis Streams plus Spark Structured Streaming
Redis Streams plus Spark Structured StreamingRedis Streams plus Spark Structured Streaming
Redis Streams plus Spark Structured StreamingDave Nielsen
 
Metaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdfMetaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdf湯米吳 Tommy Wu
 
Building Social Enterprise with Ruby and Salesforce
Building Social Enterprise with Ruby and SalesforceBuilding Social Enterprise with Ruby and Salesforce
Building Social Enterprise with Ruby and SalesforceRaymond Gao
 
MODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in PracticeMODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in PracticeHussein Alshkhir
 
Architecting for change: LinkedIn's new data ecosystem
Architecting for change: LinkedIn's new data ecosystemArchitecting for change: LinkedIn's new data ecosystem
Architecting for change: LinkedIn's new data ecosystemYael Garten
 
Strata 2016 - Architecting for Change: LinkedIn's new data ecosystem
Strata 2016 - Architecting for Change: LinkedIn's new data ecosystemStrata 2016 - Architecting for Change: LinkedIn's new data ecosystem
Strata 2016 - Architecting for Change: LinkedIn's new data ecosystemShirshanka Das
 

Similaire à NoSQL Deepdive - with Informix NoSQL. IOD 2013 (20)

Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web apps
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 
Tutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchTutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB Stitch
 
CQRS and Event Sourcing with MongoDB and PHP
CQRS and Event Sourcing with MongoDB and PHPCQRS and Event Sourcing with MongoDB and PHP
CQRS and Event Sourcing with MongoDB and PHP
 
You know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on InformixYou know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on Informix
 
Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talk
 
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
 
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
 
MongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB Stitch Introduction
MongoDB Stitch Introduction
 
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy NguyenGrokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
 
New Opportunities for Connected Data - Emil Eifrem @ GraphConnect Boston + Ch...
New Opportunities for Connected Data - Emil Eifrem @ GraphConnect Boston + Ch...New Opportunities for Connected Data - Emil Eifrem @ GraphConnect Boston + Ch...
New Opportunities for Connected Data - Emil Eifrem @ GraphConnect Boston + Ch...
 
Microsoft Entity Framework
Microsoft Entity FrameworkMicrosoft Entity Framework
Microsoft Entity Framework
 
Daniel Egan Msdn Tech Days Oc
Daniel Egan Msdn Tech Days OcDaniel Egan Msdn Tech Days Oc
Daniel Egan Msdn Tech Days Oc
 
Postgres Conf Keynote: What got you here WILL get you there
Postgres Conf Keynote: What got you here WILL get you therePostgres Conf Keynote: What got you here WILL get you there
Postgres Conf Keynote: What got you here WILL get you there
 
Redis Streams plus Spark Structured Streaming
Redis Streams plus Spark Structured StreamingRedis Streams plus Spark Structured Streaming
Redis Streams plus Spark Structured Streaming
 
Metaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdfMetaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdf
 
Building Social Enterprise with Ruby and Salesforce
Building Social Enterprise with Ruby and SalesforceBuilding Social Enterprise with Ruby and Salesforce
Building Social Enterprise with Ruby and Salesforce
 
MODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in PracticeMODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in Practice
 
Architecting for change: LinkedIn's new data ecosystem
Architecting for change: LinkedIn's new data ecosystemArchitecting for change: LinkedIn's new data ecosystem
Architecting for change: LinkedIn's new data ecosystem
 
Strata 2016 - Architecting for Change: LinkedIn's new data ecosystem
Strata 2016 - Architecting for Change: LinkedIn's new data ecosystemStrata 2016 - Architecting for Change: LinkedIn's new data ecosystem
Strata 2016 - Architecting for Change: LinkedIn's new data ecosystem
 

Plus de Keshav Murthy

N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0Keshav Murthy
 
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Keshav Murthy
 
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5Keshav Murthy
 
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...Keshav Murthy
 
Couchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing featuresCouchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing featuresKeshav Murthy
 
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram VemulapalliN1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram VemulapalliKeshav Murthy
 
Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.Keshav Murthy
 
Couchbase Query Workbench Enhancements By Eben Haber
Couchbase Query Workbench Enhancements  By Eben Haber Couchbase Query Workbench Enhancements  By Eben Haber
Couchbase Query Workbench Enhancements By Eben Haber Keshav Murthy
 
Mindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developersMindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developersKeshav Murthy
 
Couchbase N1QL: Index Advisor
Couchbase N1QL: Index AdvisorCouchbase N1QL: Index Advisor
Couchbase N1QL: Index AdvisorKeshav Murthy
 
N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0Keshav Murthy
 
From SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSONFrom SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSONKeshav Murthy
 
Tuning for Performance: indexes & Queries
Tuning for Performance: indexes & QueriesTuning for Performance: indexes & Queries
Tuning for Performance: indexes & QueriesKeshav Murthy
 
Understanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune QueriesUnderstanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune QueriesKeshav Murthy
 
Utilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and IndexingUtilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and IndexingKeshav Murthy
 
Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5Keshav Murthy
 
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLBringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLKeshav Murthy
 
Query in Couchbase. N1QL: SQL for JSON
Query in Couchbase.  N1QL: SQL for JSONQuery in Couchbase.  N1QL: SQL for JSON
Query in Couchbase. N1QL: SQL for JSONKeshav Murthy
 
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications Keshav Murthy
 
Introducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSONIntroducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSONKeshav Murthy
 

Plus de Keshav Murthy (20)

N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0
 
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
 
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
 
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
 
Couchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing featuresCouchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing features
 
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram VemulapalliN1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
 
Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.
 
Couchbase Query Workbench Enhancements By Eben Haber
Couchbase Query Workbench Enhancements  By Eben Haber Couchbase Query Workbench Enhancements  By Eben Haber
Couchbase Query Workbench Enhancements By Eben Haber
 
Mindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developersMindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developers
 
Couchbase N1QL: Index Advisor
Couchbase N1QL: Index AdvisorCouchbase N1QL: Index Advisor
Couchbase N1QL: Index Advisor
 
N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0
 
From SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSONFrom SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSON
 
Tuning for Performance: indexes & Queries
Tuning for Performance: indexes & QueriesTuning for Performance: indexes & Queries
Tuning for Performance: indexes & Queries
 
Understanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune QueriesUnderstanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune Queries
 
Utilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and IndexingUtilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and Indexing
 
Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5
 
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLBringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
 
Query in Couchbase. N1QL: SQL for JSON
Query in Couchbase.  N1QL: SQL for JSONQuery in Couchbase.  N1QL: SQL for JSON
Query in Couchbase. N1QL: SQL for JSON
 
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
 
Introducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSONIntroducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSON
 

Dernier

[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.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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 organizationRadu Cotescu
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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 MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Dernier (20)

[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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

NoSQL Deepdive - with Informix NoSQL. IOD 2013

  • 1. NoSQL DEEP DIVE Relational + JSON = Simply Powerful Jef Treece, IBM Product Manager jtreece@us.ibm.com John F. Miller III, IBM Software Architect miller3@us.ibm.com Keshava Murthy, IBM Software Architect rkeshav@us.ibm.com © 2013 IBM Corporation
  • 2. Agenda NoSQL Business Drivers Live Demo JSON Store Overview Relational + JSON = Simply Powerful 2
  • 3. NoSQL BUSINESS DRIVERS Jef Treece, IBM Product Manager jtreece@us.ibm.com @JefTreece © 2013 IBM Corporation
  • 4. What is Driving IT Demand? Advanced predictive analytics Cyber security Infrastructure optimization – cloud computing Explosion of mobile devices Business optimization + big data Real-time sensor data Growth of social media
  • 5. Business Trends Driving NoSQL Adoption ● Applications must support mobile – – ● Interoperate with modern applications with agility Enterprise infrastructure Ability to scale to big data – – Use case are driving big data – ● Commodity hardware and software Data in motion Strategy: more interactions with customers – Systems of engagement needed! – 71% CIOs see move toward social/digital collaboration – New class of applications are based on NoSQL Global C-suite Study, http://www-935.ibm.com/services/us/en/c-suite/csuitestudy2013/ Explosion of mobile devices
  • 6. NoSQL Landscape Key Value Store ● Couchbase ● Riak ● Citrusleaf ● Redis ● BerkeleyDB ● Membrain ● ... Martin Fowler says: “aggregate-oriented” What you're most likely to access as a unit. Document ● MongoDB ● CouchDB ● RavenDB ● Couchbase ● ... Column ● Cloudera ● HBase ● Hypertable ● Cassandra ● ... Graph ● OrientDB ● DEX ● Neo4j ● GraphBase ● ...
  • 7. Characteristics of a NoSQL Document Store ● Ability to manage humongous data ● Enable rapid development – – ● Flexible schema development Tap into the existing ecosystem – JSON, BSON, drivers, developers, modern applications Capture real-time interactions – Varied data sources
  • 8. JavaScript Everywhere ● JavaScript client development now dominant – – ● JavaScript and HTML5 for browser presentation JavaScript mobile applications JSON: JavaScript Object Notation – End-to-end JavaScript – The language of the web JS JS JS JS JS
  • 9. Traditional Relational Database Still Required ● Relational model works best for transactional data ● Enterprise data exists in relational databases ● Relational database preferred for most analytics You need both at the same time!
  • 10. 0 NoSQL + Relational Explosion of mobile devices – gaming and social apps E-commerce, social commerce Smart Devices Advertising: serving ads and real-time bidding Internet of Things Machine data and real-time operational decisions Social networking, online communities
  • 11. Business Value of NoSQL + RDBMS ● Level 1: Hybrid storage – JSON and relational tables in same storage engine – Different apps, same database Reduces cost and complexity! Performance! ● Level 2: Hybrid applications – A single application brings together RDBMS and NoSQL – Business insight from bringing the two different types of data and the two different requirements together New business patterns!
  • 12. IBM/MongoDB Partnership MongoDB and IBM announced a partnership in June 2013 OS BSON L JSON Query C JSON Ecosystem 12
  • 13. Enter IBM Informix 12.10 Simply powerful for both! ● Now you have the right tool for the job – all in one toolbox – System of record: Informix RDBMS – System of engagement: Informix NoSQL – Hybrid storage, hybrid applications
  • 14. Thank You! Next Up... Demo John F. Miller III, IBM Software Architect miller3@us.ibm.com
  • 15. BUILDING A REAL LIFE APPLICATION
  • 16. IOD Attendee Photo Application Allow conference attendee to take and share photo!
  • 17. Technology Highlights • Create a hybrid application using NoSQL, traditional SQL, timeseries mobile web application • Utilizing both JSON collections, SQL tables and timeseries • Utilize IBM Dojo Mobile tools to build a mobile application • Leverage new mongo client side drivers for fast application development and delployment • Demonstrate scale-out using sharding with over 100 nodes • Cloud based solution using Amazon Cloud • • Can be deployed on PureFlex or SoftLayer Provide real-time analytics on all forms of data • Leverage existing popular analytic front-end IBM-Congos • Utilize an in-memory columnar database accelerator to provide realtime trending analytics on data
  • 18. Mobile Device Application Architecture Apache Web Server IOD Photo App - UPLOAD Photo Application IBM Dojo Mobile Informix tag Van Gogh Photo collection Informix JSON Listener User Table
  • 19. Photo Application Schema TimeSeries NoSQL Collections activity_photos activity_data timeseries(photo_like)
  • 20. Application Considerations Photo meta-data varies from camera to camera A Picture and all its meta data are stored in-document Pictures are stored in a JSON collection Pre-processing on the phone ensures only reasonable size photos are sent over the network.
  • 21. Example of Live JSON Photo Data JSON Data {"_id":ObjectId("526157c8112c2fe70cc06a75"), "Make":"NIKON CORPORA TION","Model":"NIKON D60","Orientation":"1","XResolution":"300"," YResolution":"300","ResolutionUnit":"2","Software":"Ver.1.00 ","D ateTime":"2013:05:15 19:46:36","YCbCrPositioning":"2","ExifIFDPoi nter":"216","ExposureTime":"0.005","FNumber":"7.1","ExposureProgr am":"Not defined","ISOSpeedRatings":"100", "Contrast":"Normal","Saturation":"Normal","Sharpness":"Normal", "SubjectDistanceRange":"Unknown","name":"DSC_0078.JPG","img_d ata":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABcQ
  • 22. Motivation of Sharding Enables horizontal scaling (partitioning) The application strategy in step with business − Start small and grow with commodity hardware as the business grows − Grow as you go Economics of solution − − 8 4 nodes each of 4 cores 1 node of 16 cores
  • 23. Code Snippets Used PHP and mongo PHP API Example showing − Inserting − Retrieving data − Deleting JSON documents and SQL rows − Executing Stored Procedures
  • 24. Basic PHP Programming Overview Information List of NoSQL collection names and SQL tables names Function to set the active database and return the Collection private $conn; private private private private private private private $dbname = "photo_demo"; $photoCollectionName = "photos"; $contactsCollectionName = "contacts"; $sqlCollectionName = 'system.sql'; $userTableName = "users"; $tagsTableName = "tags"; $likesTableName = "likes"; private $photoQueryProjection = array("_id" => 1, "tags" => 1, "user_id" => 1, "img_data" => 1); /** * Get collection by name * @param MongoCollection $collectionName */ private function getCollection($collectionName) { return $this->conn->selectDB($this->dbname)->selectCollection ($collectionName); }
  • 25. Insert Example Information is placed in the contacts collection
  • 26. Insert Data into a Collection Very simple to insert JSON data into a collection using the MongoAPIs /** * Insert user's contact information into contacts table. */ public function insertContact( $json ) { if (! is_array ( $json )) { return "Contact info not in JSON format."; } try { $result=$this->getCollection($this->contactsCollectionName)->insert($json); if ($result ["ok"] != 1) { return $result ["err"]; } } catch ( MongoException $e ) { return $e->getMessage (); } return "ok"; }
  • 27. Retrieve Collection Information Very simple to retrieve data from a collection using the MongoAPIs Data is returned as a JSON document /** * Get all contact info */ public function adminContacts() { $contactsCollection = $this->getCollection($this>contactsCollectionName); $cursor = $contactsCollection->find(); $results = $this->getQueryResults($cursor); return $results; }
  • 28. Naughty Pictures Allow users to flag naughty pictures Have naughty pictures automatically removed
  • 29. Delete a Photo and its Information Deleting from SQL Tables and NoSQL Collection is exactly the same /** * Delete photo */ public function deletePhoto($id) { try { // First delete from likes and tags tables $query = array('photo_id' => $id['_id']); $result = $this->getCollection($this->likesTableName)->remove($query); if ($result ["ok"] != 1) { return $result["err"]; } $result = $this->getCollection($this->tagsTableName)->remove($query); if ($result ["ok"] != 1) { return $result["err"]; } // Then delete the photo from the collection $query = array('_id' => new MongoId($id['_id'])); $result = $this->getCollection ( $this->photoCollectionName )->remove ( $query ); if ($result ["ok"] != 1) { return $result["err"]; } } catch ( MongoException $e ) { return $e->getMessage(); } return "ok"; }
  • 30. Executing a Stored Procedure in MongoAPI /** * Get the user_id for a particular user name (email address). * * Calls a stored procedure that will insert into the users table if the * user does not exist yet and returns the user_id. * * @param string $username * @return int $user_id */ public function getUserId($username) { $username = trim($username); try { $sql = "EXECUTE FUNCTION getUserID('" . $username . "')"; $result = $this->getCollection($this->sqlCollectionName)->findOne(array('$sql'=>$sql)); if (isset($result['errmsg'])) { return "ERROR. " . $result['errmsg']; } return $result['user_id']; } catch (MongoException $e) { return "ERROR. " . $e->getMessage(); } }
  • 31. Real Time Analytics Customer Issues − Several different models of data (SQL, NoSQL, TimeSeries/Sensor) − NoSQL is not strong building relations between collections − Most valuable analytics combine the results of all data models − Most prominent analytic system written using standard SQL − ETL & YAS (Yet Another System) Solution Provide a mapping of the required data in SQL form − Enables common tools like Cognos
  • 32. Analytics on a Hybrid Database Photo collection SQL MongoAPI Informix User Table
  • 33. Photo Application SQL Mapping of NoSQL PHOTO Collection activity_photos activity_data timeseries(photo_like)
  • 34. Mapping A Collection To A SQL Table CREATE VIEW photo_metadata (gpslatitude, gpslongitude, make, model, orientation, datetimeoriginal, exposuretime, fnumber, isospeedratings, pixelxdimension, pixelydimension) AS SELECT BSON_VALUE_LVARCHAR ( x0.data , 'GPSLatitude' ), BSON_VALUE_LVARCHAR ( x0.data , 'GPSLongitude' ), BSON_VALUE_LVARCHAR ( x0.data , 'Make' ), BSON_VALUE_LVARCHAR ( x0.data , 'Model' ), BSON_VALUE_LVARCHAR ( x0.data , 'Orientation' ), BSON_VALUE_LVARCHAR ( x0.data , 'DateTimeOriginal' ) , BSON_VALUE_LVARCHAR ( x0.data , 'ExposureTime'), BSON_VALUE_LVARCHAR ( x0.data , 'FNumber' ), BSON_VALUE_LVARCHAR ( x0.data , 'ISOSpeedRatings' ), BSON_VALUE_LVARCHAR ( x0.data , 'PixelXDimension' ) , BSON_VALUE_LVARCHAR ( x0.data , 'PixelYDimension') FROM photos x0;
  • 35. Configure Informix on Amazon Cloud Simple • • • • • Instantiate the Amazon image Setup the storage Install the product Start the system Configure sharding
  • 36.
  • 37.
  • 38. NOSQL, JSON AND BSON OVERVIEW Technical Opportunities/ Motivation What are NoSQL Databases? Quick overview of JSON What is sharding?
  • 39. New Era in Application Requirements Store data from web/mobile application in their native form − New web applications use JSON for storing and exchanging information − Very lightweight – write more efficient applications − It is also the preferred data format for mobile application back-ends Move from development to production in no time! − Ability to create and deploy flexible JSON schema − Gives power to application developers by reducing dependency on IT Ideal for agile, rapid development and continuous integration 25
  • 40. What is a NoSQL Document Store? Not Only SQL or NOt allowing SQL A non-relational database management systems − Flexible schema − Avoids join operations − Scales horizontally − Eventually consistent (no ACID) Good with distributing data and fast application development Provides a mechanism for storage and retrieval of data while providing horizontal scaling. 26
  • 41. IBM Use Case Characteristics for JSON 27
  • 42. Example of Supported JSON Types There are 6 types of JSON Values Example of each JSON type Mongo-specific JSON types in blue – date 28 { "string":"John", "number":123.45, "boolean":true, "array":[ "a", "b", "c" ], "object: { "str":"Miller", "num":711 }, "value": NULL, "date": ISODate("2013-10-01T00:33:14.000Z") }
  • 43. The Power of JSON Drives Flexible Schema JSON key value pair enables a flexible schema Flexible schema simplifies deployment of new/upgraded applications Fast/Agile application development − Minimal to no schema management Adept at variable attribute management − Easy to add new parts or objects No transformation of data to match schema 29
  • 45. Simple Code Example use mydb db.posts.insert( ‘{“author”:”John”, “date”,”2013-04-20”,”post”,”mypost ”}’ ) Creates the database “mydb” if it does not exists Creates the collection “posts” if the it does not exists Insert a record into a blog post by user John db.posts.find ( ‘{ “author”:”John” }’ ) Retrieve all posts by user John 31
  • 46. Dynamic Elasticity Rapid horizontal scalability − Ability for the application to grow by adding low cost hardware to the solution − Ability to add or delete nodes dynamically − Ability rebalance the data dynamically Application transparent elasticity 32
  • 47. Difference between Sharding Data VS Replication Shard Key state= “CA” Shard Key state= “WA” Sharding Each node holds a portion of the data • Hash • Expression 33 Same data on each node Inserted data is placed on the correct node Shard Key state= “OR” Replication Data is copied to all nodes Operations are shipped to applicable nodes Work on local copy and modification are propagated
  • 49. IBM Informix High Level Solution 35
  • 50. Two New Data Types JSON and BSON Native JSON and BSON data types Index support for NoSQL data types Native operators and comparator functions allow for direct manipulation of the BSON data type Database Server seamlessly converts to and from JSON BSON Character data 36 JSON
  • 51. Informix JSON Store Benefits Informix provides − Row locking on the individual JSON document MongoDB locks the database − Large documents, up to 2GB maximum size MongoDB limit is 16MB − Ability to compress documents MongoDB currently not available − Ability to intelligently cache commonly used documents MongoDB currently not available 37
  • 52. Flexible Schema Applications use JSON, a set of key-value pairs JSON is text , BSON is the binary representation. The explicit key-value pairs within the JSON/BSON document will be roughly equivalent to columns in relational tables. Applications typically denormalize the schema − 38 Customer, customer address, customer contacts all in a single JSON
  • 53. Flexible Schema However, there are differences! − − − − − − 39 The type of the Key Value data encoded within BSON is determined by the client Server is unaware of data type of each Key Value pair at table definition time. No guarantees that data type for each key will remain consistent in the collection. The keys in the BSON document can be arbitrary While customers exploit flexible schema, they’re unlikely to create a single collection and dump everything under the sun into that collection. Developers typically denormalize the tables (a JSON document will contain customer+customer addr + customer demographics + ) to avoid joins.
  • 54. Indexing • Supports B-Tree indexes on any key-value pairs. • Typed indices could be on simple basic type (int, decimal,) • Type-less indices could be created on BSON and use BSON type comparison • Informix translates ensureIndex() to CREATE INDEX • Informix translates dropIndex() to DROP INDEX Mongo Operation db.customers.ensureIndex( {orderDate:1, zip:-1}) CREATE INDEX IF NOT EXISTS v_customer_2 ON customer (bson_extract(data,‘orderDate') ASC, bson_extract(data,‘zip') DESC) USING BSON db.customers.ensureIndex( {orderDate:1},{unique:true}) 40 SQL Operation CREATE UNIQUE INDEX IF NOT EXISTS v_customer_3 ON customer (bson_extract(data,'c1') ASC USING BSON
  • 55. Scaling Out Using Sharded Queries Shard Key state= “CA” Shard Key state= “WA” Find sold cars for all states 1. Request data from local shard 2. Automatically sends request to other shards requesting data 3. Returns results to client Shard Key state= “OR” 41 41
  • 56. Scaling Out Using Sharded Inserts Shard Key state= “CA” Shard Key state= “WA” Row state = “OR” 1. Insert row sent to your local shard 2. Automatically forward the data to the proper shard Shard Key state= “OR” 42 42
  • 57. Scaling Out Adding a Shard Shard Key state= “CA” Shard Key state= “WA” Command Add Shard “NV” 1. Send command to local node 2. New shard dynamically added, data re-distributed (if required) Shard Key state= “OR” 43 Shard Key state= “NV”
  • 58. Sharding with Hash Hash based sharding simplifies the partitioning of data across the shards Benefits − No data layout planning is required − Adding additional nodes is online and dynamic Cons − Adding additional node requires data to be moved Data automatically broken in pieces 44
  • 59. Mongo API Command to add a shard in Informix Add just a single shard db.runCommand({"addShard":"hostname1:port1"}) Add multi shard in a single command − Informix only syntax db.runCommand({"addShard":["hostname2:port2", "hostname3:port3", "hostname4:port4"]}) Shard the table phot_demo.photos by hash sh.shardCollection("photo_demo.photos", {"_id": "hashed"})
  • 60. Difference between Sharding Data VS Replication Shard Key state= “CA” Shard Key state= “WA” Sharding Each node holds a portion of the data • Hash • Expression 46 Same data on each node Inserted data is placed on the correct node Shard Key state= “OR” Replication Data is copied to all nodes Operations are shipped to applicable nodes Work on local copy and modification are propagated
  • 61. Sharding is not for Data Availability Sharding is for growth, not availability Redundancy of a node provides high availability for the data − Both Mongo and Informix allow for multiple redundant nodes − Mongo refers to this as Replica Sets and the additional nodes slaves − Informix refers to this as H/A, and additional secondary nodes Term Description Informix Term Shard A single node or a group of nodes holding the same data (replica set) Instance Replica Set A collection of nodes contain the same data HA Cluster Shard Key The field that dictates the distribution of the documents. Must always exist in a document. Shard Key Sharded Cluster A group shards were each shard contains a portion of the Grid/Region data. Slave A server which contains a second copy of the data for read only processing. 47 HA Secondary Server
  • 62. Informix Secondary Servers Features of Informix secondary server: − Provide high availability Can have one or more secondary servers Synchronous or asynchronous secondary servers Automatic promotion upon server failure − Scale out Execute select Allow Insert/Update/Deletes on the secondary servers Secondary server can have their own disk or share disks with the master node − 48 Connection manager routes users connection based on policies and server availability
  • 63. Informix NoSQL Cluster Architecture Overview three independent copies of the data, but four servers to share the workload (two servers share the same disk). Read/Write activity supported on all servers Shard Key state= “CA” Shard Key state= “OR” 49 Shard Key state= “WA” © 2013 IBM Corporation
  • 65. Ability for All Clients to Access All Data Models Informix SQLI Drivers IBM DRDA Drivers MongoDB Drivers Traditional SQL NoSQL - JSON TimeSeries MQ Series 51
  • 67. Client Applications Applications MongoDB native Client New Wire Protocol Listener supports existing MongoDB drivers Connect to MongoDB or Informix with same application! MongoDB driver MongoDB Wire Protocol IBM JDBC NoSQL Driver Wire Protocol Listener MongoDB web browser Informix DB Mobile 53
  • 68. MongoDB Application Driver Compatibly Ability to use any of the MongoDB client drivers and frameworks against the Informix Database Server − Little to no change required when running MongoDB programs − Informix listens on the same default port as mongo, no need to change. Leverage the different programming languages available All Support Languages C Perl C# PHP Erland Python Java Ruby JavaScript Scala Node.js Other Community Drivers are also available 54
  • 70. Hybrid Access between Relational & JSON Collections Relational Table SQL API Standard ODBC, JDBC, .NET, OData, etc. Language SQL. MongoDB API (NoSQL) ? JSON Collections ? Mongo APIs for Java, Javascript, C++, C#,...
  • 71. Why do you need hybrid access?
  • 72. Benefits of Simply Powerful Access consistent data from its source Avoid ETL, continuous data sync and conflicts. Exploit the power of SQL, MongoAPI seamlessly Exploit the power of RDBMS technologies in MongoAPI: − − − Informix Warehouse accelerator (Blu technologies) Cost based Optimizer R-tree indices for spatial, Lucene text indexes, and more. Access all your data thru any interface: MongoAPI or SQL. Store data in one place and efficiently transform and use them on demand. Existing SQL based tools and APIs can access new data in JSON
  • 73. Hybrid Access between Relational & JSON Collections Relational Table SQL API MongoDB API (NoSQL) Standard ODBC, JDBC, .NET, OData, etc. Language SQL. Mongo APIs for Java, Javascript, C++, C#,... JSON Collections Direct SQL Access. Dynamic Views Row types Mongo APIs for Java, Javascript, C++, C#,...
  • 74. Ability for All Clients to Access All Data Models Informix SQLI Drivers IBM DRDA Drivers MongoDB Drivers Traditional SQL NoSQL - JSON TimeSeries MQ Series 60
  • 75. Hybrid access: From MongoAPI to relational tables. You want to develop an application with MongoAPI, but 1. You already have relational tables with data. 2. You have views on relational data 3. You need to join tables 4. You need queries with complex expressions. E.g. OLAP window functions. 5. You need multi-statement transactions 6. You need to exploit stored procedure 7. You need federated access to other data 8. You have timeseries data.
  • 76. MongoAPI Accessing Both NoSQL and Relational Tables Mongo Application JSON JSON Informix IBM Wire Listener db.customer.find({state:”MO”}) db.partners.find({state:”CA”}) Access JSON Access Relational SELECT bson_new(bson, ‘{}’) FROM customer WHERE bson_value_lvarchar(bson,‘state’)=“MO” JSON Collections Customer Tables Relational Tables IDXs SELECT * FROM partners WHERE state=“CA” IDXs partners Tables Enterprise replication + Flexible Grid + Sharding Distributed Queries Logs
  • 77. How to Convert Relational Data as JSON Documents Relational data can be treated as structured JSON documents; column name-value becomes key-value pair. SELECT partner, pnum, country from partners; partner pnum Country Pronto 1748 Australia Kazer 1746 USA Diester 1472 Spain Consultix 1742 France {parnter: {parnter: {parnter: {parnter: “Pronot”, pnum:”1748”, Country: “Australia”} “Kazar”, pnum:”1746”, Country: “USA”} “Diester”, pnum:”1472”, Country: “Spain”} “Consultix”, pnum:”1742”, Country: “France”} Informix automatically translates the results of a relational query to JSON/BSON form.
  • 78. MongoAPI Accessing Both NoSQL and Relational Tables • Typically NoSQL does not involve transactions • • • In many cases, a document update is atomic, but not the application statement Example • 7 targeted for deletion, but only 4 are removed Informix-NoSQL provides transactions on all application statements • • Each server operation INSERT, UPDATE, DELETE, SELECT will automatically be committed after each operation. In Informix there is away to create multi-statement transactions is to utilize a stored procedure • Default isolation level is DIRTY READ • All standard isolation level support
  • 79. Accessing Data in Relational Tables CREATE TABLE partners(pnum int, name varchar(32), country varchar(32) ); db.partners.find({name:”Acme”}, {pnum:1, country:1}); SELECT pnum, country FROM partners WHERE name = “Acme”; db.partners.find({name:”Acme”}, {pnum:1, country:1}).sort({b:1}) SELECT pnum,country FROM partners WHERE name=“Acme” ORDER BY b ASC
  • 80. Accessing data in relational tables. db.partners.save({pnum:1632,name:”EuroTop”,Country:“Belgium”}); INSERT into partners(pnum, name, country) values (1632, ”EuroTop”, “Belgium”); db.partners.update({country:”Holland”}, {$set:{country:”Netherland”}}, {multi: true}); UPDATE partners SET country = “Netherland” WHERE country = “Holland”; db.partners.delete({name:”Artics”}); DELETE FROM PARTNERS WHERE name = “Artics”;
  • 81. Views and Joins Create a view between the existing partner table and a new pcontact table create table pcontact(pnum int, name varchar(32), phone varchar(32)); insert into pcontact values(1748,"Joe Smith","61-123-4821"); create view partnerphone(pname, pcontact, pphone) as select a.name, b.name, b.phone FROM pcontact b left outer join partners a on (a.pnum = b.pnum); Run the query across the view db.partnerphone.find({pname:"Pronto"}) { "pname":"Pronto", "pcontact":"Joe Smith", "pphone":"61-123-4821"}
  • 82. Seamless federated access 1. 2. create database newdb2; create synonym oldcontactreport for newdb:contactreport; > use newdb2 > db.oldcontactreport.find({pname:"Pronto"}) { "pname" : "Pronto", "pcontact" : "Joel Garner", "totalcontacts" : 2 } { "pname" : "Pronto", "pcontact" : "Joe Smith", "totalcontacts" : 2 } SELECT data FROM oldcontactreport WHERE bson_extract(data, 'pname') = “Pronto”; • create synonym oldcontactreport for custdb@nydb:contactreport;
  • 83. Get results from a stored procedure. create function "keshav".p6() returns int, varchar(32); define x int; define y varchar(32); foreach cursor for select tabid, tabname into x,y from systables return x,y with resume; end foreach; end procedure; create view "keshav".v6 (c1,c2) as select x0.c1 ,x0.c2 from table(function p6())x0(c1,c2); db.v6.find().limit(5) { { { { { "c1" "c1" "c1" "c1" "c1" : : : : : 1, 2, 3, 4, 5, "c2" "c2" "c2" "c2" "c2" : : : : : "systables" } "syscolumns" } "sysindices" } "systabauth" } "syscolauth" }
  • 84. Access Timeseries data create table daily_stocks ( stock_id integer, stock_name lvarchar, stock_data timeseries(stock_bar) ); -- Create virtual relational table on top (view) EXECUTE PROCEDURE TSCreateVirtualTab('daily_stocks_virt', 'daily_stocks', 'calendar(daycal),origin(2011-01-03 00:00:00.00000)' ); create table daily_stocks_virt ( stock_id integer, stock_name lvarchar, timestamp datetime year to fraction(5), high smallfloat, low smallfloat, final smallfloat, vol smallfloat );
  • 85. Access Timeseries data db.daily_stocks_virt.find({stock_name:"IBM"}) { "stock_id" : 901, "stock_name" : "IBM", "timestamp" : ISODate("2011-01-03T06:0 0:00Z"), "high" : 356, "low" : 310, "final" : 340, "vol" : 999 } { "stock_id" : 901, "stock_name" : "IBM", "timestamp" : ISODate("2011-01-04T06:0 0:00Z"), "high" : 156, "low" : 110, "final" : 140, "vol" : 111 } { "stock_id" : 901, "stock_name" : "IBM", "timestamp" : ISODate("2011-01-06T06:0 0:00Z"), "high" : 99, "low" : 54, "final" : 66, "vol" : 888 }
  • 86. You want to perform complex analytics on JSON data BI Tools like Cognos, Tableau generate SQL on data sources. Option 1: Do ETL Need to expose JSON data as views so it’s seen as a database object. − We use implicit casting to convert to compatible types − The references to non-existent key-value pair returns NULL Create any combination of views − A view per JSON collection − Multiple views per JSON collection − Views joining JSON collections, relational tables and views. Use these database objects to create reports, graphs, etc.
  • 87. Analytics SQL & BI Applications ODBC, JDBC connections Informix JSON Collections Customer Tables & views Tables Orders Relational Tables partners Inventory Tables CRM Tables
  • 88. Benefits of Hybrid Power Access consistent data from its source Avoid ETL, continuous data sync and conflicts. Exploit the power of SQL, MongoAPI seamlessly Exploit the power of RDBMS technologies in MongoAPI: − Informix Warehouse accelerator, − Cost based Optimizer & power of SQL − R-tree indices for spatial, Lucene text indexes, and more. Access all your data thru any interface: MongoAPI & SQL Store data in one place and efficiently transform and use them on demand. Existing SQL based tools and APIs can access new data in JSON
  • 89. The Hybrid Solution Informix has the Best of Both Worlds Relational and non-relational data in one system NoSQL/MongoDB Apps can access Informix Relational Tables Distributed Queries Multi-statement Transactions Enterprise Proven Reliability Enterprise Scalability Enterprise Level Availability Informix provides the capability to leverage the abilities of both relational DBMS and document store systems. 75
  • 90. Informix Specific Advantages with Mongo Drivers Traditional SQL tables and JSON collections co-existing in the same database Using the MongoDB client drivers Query, insert, update, delete − JSON collections − Traditional SQL tables − Timeseries data Join SQL tables to JSON collections utilizing indexes Execute business logic in stored procedures Provide a view of JSON collections as a SQL table − Allows existing SQL tools to access JSON data Enterprise level functionality 76