No sql or Not only SQL

Preview:

Citation preview

NoSQL THE NEW ERA OF

INTERPRETING DATA

NAME:- AJAYKANT C. JHA

EXAM NO:- 2845 3rd Year B.C.A, 6th Semester

S.D.J INTERNATIONAL COLLEGE

1

Content2

Origination

What is NoSQL ?

NoSQL: Main Categories

Pros and Cons of NoSQL

RDBMS VS NoSQL

Performance

Comparisons

Summary

Bibliography

Origination3

• 1998 – • Carlo Strozzi used the term NoSQL to name its

lightweight open-source relational DB with no SQL interface.

• Strozzi suggests NoREL referring to ‘No Relational’

• 2009 – • Eric Evans reintroduced the terms NoSQL when Johan

Oskarsson of Last.fm wanted to organize an event to discuss open source distributed databases.

What is NoSQL ?4

• NoSQL is an approach towards data store about users, objects and products, the frequency in which this data is accessed, and performance and processing needs.

• Actually Not only SQL

• Eventually consistent, depends…

• RDBMS is based on ACID Theorem but NoSQL is based on CAP Theorem

NoSql : Main Categories5

Key-Value Stores6

• Data Model: • Global collection of Key/Value pairs

• Support relationship but with each table having only two columns

• Every item in the database is stored in the pairs of keys(Indexes) and values

• Key is used to access Value

• Value contains blobs with keys without joins

• E.g a gaming website that constantly updates the top 10 scores and players

Blob datatype

String dataype

7

• A table with two columns and a simple interface• Get(key), returns the value associated

with the provided key.• Put( key, value), associates the value

with the key• Multi-get (key1,key2,…,keyN), returns

the list of values associated with the list of keys.

• Delete (key), removes the entry for the key from data store.

KeyValu

eKey

Key-Value Stores

Key-Value Stores8

The Locker Metaphor

Key-Value Stores9

Key-Values Stores are Like Dictionaries

The “key” is just the word “gouge” The “value” is all the definitions and images

Key-Value Stores10

No Subset Queries in Key-Value Stores

• Traditional Relational Model• Result set based on row values• Values of rows for large data sets must be indexed• Values of columns must all have the same data type

• Key-Value Store Model• All queries return a single item• No indexes on values• Values may contain any data type

Key-Value Stores11

• Pros:• Scalable• Simple Data Model (Get, Put, Multi-get, Delete)

• Cons:• No way to query based on the content of the value• Cannot update the value of the key• No relationship, create your own foreign keys• Not suitable for complex data

Wide Column Store12

• Data Model : • Rows and Columns

• It is also known as Column Family Store

• Stores data tables as sections of columns of data rather than as rows of data that have many columns associated with a row key

• Column families are groups of related data that is often accessed together

Wide Column Store13

• There are two types of Column Families:

• Standard Column Family: Consists of a key value pair, where the key is mapped to a value that is set of columns.

• Super Column Family: Consists of a key-value pair, where the key is mapped to a value that are column families.

Wide Column Store14

Use a combination of Row and Column as a Key

Column ID

Row ID

Key

Row Number

Column Number

Value

Wide Column Store15

Key

• Systems have keys that include Row ID, Column Family, Column Name and Timestamp

• Key is permanent name of the record.• Each key is associated with multiple Columns and includes

a row, column family and column name• Timestamps contains the last modified value• Values are just ordered bytes and have no strongly typed

data system

Timestamp ValueColumn Name

Column Family

Row ID

Wide Column Store16

Col1 Col100000

Wide Column Store17

Table

Super Col X

Super Col Y

Fam1

Col-BCol-A

Fam2

• Column Families are created when a table is created

• Column Family is how the data is stored on the disk

• Group columns into “Column families”• Column Family can contains Columns

and Super Columns• Super column contains other columns

but not super columns

Wide Column Store18

• Pros: • Scalable• Queries can be done on rows, column families and column names• Store blobs in one large table

• Cons: • Cannot query blob content, row and column• Not suitable for relational data

Document Store19

• Data Model : • Collections of key value collection

• Good at handling content management, profile management

• Eventual consistency

• Similar to a Key/Value database but with a major difference between, Values are stored in structured documents in nested hierarchies which provide some structure and encoding of the data

Document Store20

Darker lines mean

“required” and Light lines

mean “optional elements”

Books can have 0 to many author- names

<books> is our root element

Format and license

elements are codes that must be in a fixed list of choices

books> contain Each <book> only valid URL characters

a sequence of one contains the

to many <book> following sequence

Elements of elements

Must be a valid decimal number

IdType: xs.string

titleType: xs.string

author-nameType: xs.string

format-codeType: format-code-type

list-priceType: xs.decimal

urlType: xs.anyURL

isbnType: xs.string

license codeType: license code-type

descriptionType: xs.string

bookbooks . .

Document Store21

• Pros• Simple & Powerful Data model• Scalable• Any number of fields can be added• Any item in the document can be queried• Each document in the document store is independent and there is

relational integrity

• Cons• Not suitable for relational data• Querying limited to keys & Indexes

Graph Store22

• Data Model:• Nodes• Edges between Nodes• Properties

• These databases uses edges and nodes to represent and store data.

• These nodes are organised by some relationships with one another, which is represented by edges between the nodes

• Both the nodes and the relationships have some defined properties

Graph Store23

• Used when the relationship and relationships types between items are critical

• Focused on modelling the structure of the data- interconnectivity

• Data is stored in a series of nodes, relationship and properties

• Ideal when relationships between data is key: E.g Social Networks

Graph Store24

Nodes are “joined” to create graphs

Has-Author

Has-Name

Has-Author Has-Name

BookPerson

123

Person123

“Dan”Book

“Dan”

Person123

Wide Column Store25

• Pros: • Connected data is locally indexed• Extremely powerful

• Cons: • Difficult to scale up

Pros of NoSQL26

Cons of NoSQL27

• Need whole value from the key; to read / write any partial information

• Data store is merely a storage layer cannot be used to generate report

• Not recognized by ISO

• Response time, depends on each solution

RDBMS vs. NoSQL28

NoSQL is real and it’s here to stay

Performance29

Data Model Performance Flexibility Complexity Functionality

Key-Value store

High High None Variable (none)

Wide Column Store

High Moderate Low Minimal

Document Store

High High Low Variable (low)

Graph Store Variable High High Graph theory

Relational Store

Variable Low Moderate Relational Algebra

.

Comparisons30

SQL Databases NoSQL Databases

Types One type with minor variations

Many different types

Development history

1970 2009

Data Individual records are stored much like

spreadsheets

Varies based on database type

Scaling DBA is must DBA may be required

Development model

Mix of open source Open source

SUMMARY31

• Pick right data model for right problem

• Pick the right tool for right job

• Understand the data storage

• Compare pros and cons

• NoSQL is a great tool for solving data availability problems

Bibliography32

• http://manning.com/mccreary • http://NoSQLNOW.com • http://Pass.ly/NoSQLTechGuide • http://en.wikipedia.org/wiki/NoSQL • http://vineetgupta.com/2010/01/nosql-database-part-1-

landscape.html • http://venublog.com • http://nosql.mypopescu.com/• http://highscalability.com/• http://scalein.com

33

Questions ?

34

THANK YOU

Recommended