An Introduction to NoSQL

Thameera Senanayaka

Allion Technologies

  • SQL Server
  • MySQL
  • PostgreSQL
  • Oracle
  • SQLite

Databases we use

Relational Databases

Relational Databases

  • Tables
  • Schemas & Normalization
  • SQL to query data

What is NoSQL?

  • Any database that is not a relational database
  • Schema-less
  • Running well on clusters

NoSQL !=

NoSQL ==

{
  _id: xxxxx,
  article_id: yyyy,
  time: yymmdd,
  text: abcde
}

Use Case - Comments in a blog

Use Case - Comments in a blog

{
  _id: xxxxx,
  article_id: yyyy,
  time: yymmdd,
  text: abcde,
  author: {
    id: xxx,
    name: 'user'
  }
}

Use Case - Comments in a blog

{
  _id: xxxxx,
  article_id: yyyy,
  time: yymmdd,
  text: abcde,
  author: {
    id: xxx,
    name: 'user'
  },
  replies: [
    { ... },
    { ... }
  ]
}

Use Case - Comments in a blog

{
  title: 'some title',
  post: 'post',
  date: yymmdd,
  comments: [
    {
      _id: xxxxx,
      time: yymmdd,
      text: abcde,
      author: {
        id: xxx,
        name: 'user'
      },
      replies: [
        { ... },
        { ... }
      ]
    },
    {
      ...
    }
  ]
}

Types of NoSQL databases

1. Document Store

Types of NoSQL databases

2. BigTable

Types of NoSQL databases

3. Key-value store

Types of NoSQL databases

4. Graph

SQL NoSQL
Rows Documents
Tables Columns
Requires a schema Schema-less
JOINs No JOINs (data is denormalized)
Transactional guarantees No guarantees for multiple documents
Can be scaled (with some effort) Excellent performance & scalability
SQL querying JSON data object querying

Why NoSQL?

  • Big data
  • Real time analytics
  • IoT
  • Rapid development

Final words

  • None is better than the other
  • Right tool for right job
  • Don't think everything is a nail for your hammer

Thank you!

Introduction to NoSQL

By Thameera

Introduction to NoSQL

  • 1,371