CE419 Session 26: NoSQL Databases Web Programming The Relational - - PowerPoint PPT Presentation

ce419
SMART_READER_LITE
LIVE PREVIEW

CE419 Session 26: NoSQL Databases Web Programming The Relational - - PowerPoint PPT Presentation

CE419 Session 26: NoSQL Databases Web Programming The Relational Model Relational database management systems require defined and clearly set schemas. Use SQL to query for data. Despite their strict nature of forming and handling


slide-1
SLIDE 1

CE419 Web Programming

Session 26: NoSQL Databases

slide-2
SLIDE 2

The Relational Model

  • Relational database management systems require

defined and clearly set schemas.

  • Use SQL to query for data.
  • Despite their strict nature of forming and handling data,

relational databases can become extremely flexible and

  • ffer a lot, granted with a little bit of effort.
slide-3
SLIDE 3

NoSQL

  • A NoSQL database provides a

mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases.

  • NoSQL database systems do

not come with a model as used (or needed) with structured relational solutions.

  • NoSQL databases do not have

a common way to query the data and each solution provides its own query system.

slide-4
SLIDE 4

SQL vs. NoSQL

  • Structure and type of data being kept
  • Querying
  • Scaling
  • Reliability
  • Support
  • Complex data keeping and querying needs
slide-5
SLIDE 5

NoSQL (cont'd)

  • Types
  • Key-Value stores
  • Graph
  • Column-oriented
  • Document
  • Multi-model
slide-6
SLIDE 6

Key-Value Stores

  • A key-value store, or key-value database, is a computer

program designed for storing, retrieving, and managing associative arrays (dictionaries).

  • Redis: SHOWTIME.
  • Example usages?
slide-7
SLIDE 7

Graph Databases

  • A graph database is a database that uses graph

structures for semantic queries with nodes, edges and properties to represent and store data.

  • Examples:
  • Neo4j
  • FlockDB
slide-8
SLIDE 8

Column-oriented Databases

SNO STATUS CITY SNAME

  • -- ------ ---- -----

S1 20 London Smith S2 10 Paris Jones S3 30 Paris Blake S4 20 London Clark S5 30 Athens Adams S120LondonSmith;S210Paris Jones;S330ParisBlake;S420 LondonClark;S530AthensAda ms S1S2S3S4S5;2010302030;Lon donParisParisLondonAthens ;SmithJonesBlakeClarkAdam s

slide-9
SLIDE 9

Column-oriented Databases (cont'd)

slide-10
SLIDE 10

Document Databases

  • Sometimes data is not easy to describe with relational

databases.

  • Example: a product search engine.

{ name: "Peugeot 206", price: 36000000, hp: 105, top_speed: 180, gearbox: "manual", color: "White" } { name: "Seagate HDD", price: 210000, capacity: "500GB", rpm: 7200, ports: ["SATA", "USB"], color: "Red" }

slide-11
SLIDE 11

Document Databases (cont'd)

  • Documents may be addressed in the database via a

unique key that represents that document.

  • Auto-increment integer?
  • UUID, ObjectId
slide-12
SLIDE 12

UUID

  • Universally Unique Identifier
  • A UUID is simply a 128-bit value. The meaning of each bit

is defined by any of several variants.

  • Human readable display
  • The intent of UUIDs is to enable distributed systems to

uniquely identify information without significant central coordination.

de305d54-75b4-431b-adb2-eb6b9e546014

slide-13
SLIDE 13

UUID Variants

  • Version 1 (MAC Address & date-time)
  • Single point in time & space
  • Version 4 (Random)
  • udid library in Python.
slide-14
SLIDE 14

MongoDB

  • MongoDB is the most popular NoSQL, document based,

database system.

  • MongoDB can still hold various databases of different

names within one installation package.

  • But inside databases are collections, not tables.
  • A collection may be considered a table except there

are no aligned columns.

slide-15
SLIDE 15

What does it mean?

  • Consider a collection of users.
  • Now each of these entries or rows inside a collection is

called a document.

  • They are basically JSON data blocks.
slide-16
SLIDE 16

Querying MongoDB

  • mongo command opens MongoDB shell.
  • It's a JavaScript shell!
slide-17
SLIDE 17

Querying MongoDB (cont'd)

  • db.collection.find()
  • db.collection.insert()
  • db.collection.update()
  • etc…
  • Let's see something in action!
slide-18
SLIDE 18

CAP Theorem

  • CAP theorem states that there are three basic

requirements which exist in a special relation when designing applications for a distributed architecture:

  • Consistency, Availability, Partition Tolerance
slide-19
SLIDE 19