NOSQL Prepared by, B.Maaithili Assistant Professor, Department of Information Technology, Saiva Bhanu Kshatriya college, Aruppukottai
NOSQL • Stands for Not Only SQL • Non-Relational databases that store data in a non-tabular format (document based either JSON or BSON) • Consistent • Handle large volumes of data • Flexible Schema • Horizontally scalable , by adding nodes instead of upgradation • Replication support • Faster than Traditional RDBMS • Uses Query Language or API • Distributed Architecture to build highly available & Partition – Tolerating system • Well suited in Big Data & Real-Time Analytics
NOSQL Types 1. Key – Value Store 2. Column -Family store 3. Document store 4. Graph based
Key-Value Store • These databases store data as a collection of key-value pairs. • Each key is unique and maps to a specific value • They are commonly used for caching, session and relational database management system,, and real-time data processing. • Ex: Redis and DynamoDB
Column- Family Store • This Database organize data into column families, which are groups of related columns. • Each row in a column-family database can have a different set of columns. • Row keys are unique to each row. • Eg: Cassandra and HBase
Document Store • These databases store data in documents, usually in JSON or BSON format. • Each document contains data as key-value pairs. • Unique key is assigned for each document, and that key value is help to storage, retrieval & management of that document data. • Ex: CouchDB & MongoDB
Graph-Based • These databases use graph structures to represent and store data. • Nodes representing entities, Edges representing relationships, and Properties providing additional information about nodes and edges. • They are excel at managing and querying complex data relationships. • They are mainly used in the applications like social networks, fraud detection, and recommendation systems. • Ex: Neo4j and OrientDB.
CouchDB • Open Source NoSQLDB from Apache Software Foundation. • Document-based one. • Stores data in JSON Format(Java Script Object Notation). Provides, • Easy data handling • Flexible Schema • Each document has a Unique ID & Revision ID for managing Update. • Use RESTful HTTP API to interact with the database. – CURD (Create,Update,Read,Delete) Operations done by the HTTP request GET,POST,PUT & Delete • Uses MapReduce functions to create views and query data. • ACID properties (Atomicity, Consistency, Isolation, Durability) are followed. • Fault-tolerant Storage • Replication is used to achieve fault-tolerant via Master to Master or Master to Slave • IT offers built-in, easy-to-use replication capabilities, enabling synchronization of databases across multiple servers or devices for data distribution, backup, and high availability. • It employs MVCC for optimistic concurrency control, allowing multiple clients to read and write data concurrently without requiring locks on the database.
CouchDB
CouchDB Communication CouchDB cURL CouchDB Fauxton It is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, TFTP, DICT, TELNET, LDAP or FILE) The cURL utility is available in operating systems such as UNIX, Linux, Mac OS X and Windows. Fauxton is a web-based interface allowing users to create, update, delete, and view documents and design documents. It is a command line utility using which user can access HTTP protocol straight away from the command line. It provides a simple graphical interface,& provides full access to all CouchDB features To access website curl https://google.com/ To get help $ curl ?help or $ curl –help List of cURL utility curl [options] <URL> Options: example -d => send data with HTTP POST -O => write output Database Features: • Create DB • Destroy DB Document Features: • Create • Update • Edit • Delete
MongoDB • It is a cross-platform, document oriented database that provides, high performance, high availability, and easy scalability. • It works on concept of collection and document. Database • Database is a physical container for collections. • Each database gets its own set of files on the file system. • A single MongoDB server typically has multiple databases. Collection • Collection is a group of MongoDB documents. • It is the equivalent of an RDBMS table. • A collection exists within a single database. • Documents within a collection can have different fields. Document • A document is a set of key-value pairs. • Documents have dynamic schema. • Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection's documents may hold different types of data.
MongoDB Example:
Features of MongoDB • Document Oriented: MongoDB stores the main subject in the minimal number of documents and not by breaking it into multiple relational structures like RDBMS. • Indexing: Without indexing, a database would have to scan every document of a collection to select those that match the query which would be inefficient. – So, for efficient searching Indexing is must and MongoDB uses it to process huge volumes of data in very less time. • Scalability: MongoDB scales horizontally using sharding (partitioning data across various servers). Data is partitioned into data chunks using the shard key and these data chunks are evenly distributed across shards that reside across many physical servers. Also, new machines can be added to a running database. • Replication and High Availability: MongoDB increases the data availability with multiple copies of data on different servers. By providing redundancy, it protects the database from hardware failures. If one server goes down, the data can be retrieved easily from other active servers which also had the data stored on them. • Aggregation: Aggregation operations process data records and return the computed results. It is similar to the GROUPBY clause in SQL. A few aggregation expressions are sum, avg, min, max, etc.
CouchDB Vs MongoDB Feature CouchDB MongoDB Type Document oriented Document oriented Data model Stores data as JSON documents with a unique ID Stores data as BSON documents with ID Storage Append only storage engine MVCC WiredTiger (default), Supports journaling & compression Query Language MapReduce Rich query language, supports CRUD operations Indexing Secondary indexes created Secondary, compound, text indexes & geospatial Replication Master – Master replication with MVCC Master – Slave replication with automatic failover Scalability Peer- to –peer , distributed, offline first systems Sharding for horizontal scaling, designed for large scale high performance apps Transactions Document level ACID properties Multi document ACID transactions Consistency Model Eventual Strong Use Case Offline – first apps Real-time analytics, Big Data, High –performance web apps Performance Slower for complex queries Faster
Thank You

NOSQL, TYPES, Couch DB, MongoDB , Couch DB VS MongoDB

  • 1.
    NOSQL Prepared by, B.Maaithili Assistant Professor, Departmentof Information Technology, Saiva Bhanu Kshatriya college, Aruppukottai
  • 2.
    NOSQL • Stands forNot Only SQL • Non-Relational databases that store data in a non-tabular format (document based either JSON or BSON) • Consistent • Handle large volumes of data • Flexible Schema • Horizontally scalable , by adding nodes instead of upgradation • Replication support • Faster than Traditional RDBMS • Uses Query Language or API • Distributed Architecture to build highly available & Partition – Tolerating system • Well suited in Big Data & Real-Time Analytics
  • 3.
    NOSQL Types 1. Key– Value Store 2. Column -Family store 3. Document store 4. Graph based
  • 4.
    Key-Value Store • Thesedatabases store data as a collection of key-value pairs. • Each key is unique and maps to a specific value • They are commonly used for caching, session and relational database management system,, and real-time data processing. • Ex: Redis and DynamoDB
  • 5.
    Column- Family Store •This Database organize data into column families, which are groups of related columns. • Each row in a column-family database can have a different set of columns. • Row keys are unique to each row. • Eg: Cassandra and HBase
  • 6.
    Document Store • Thesedatabases store data in documents, usually in JSON or BSON format. • Each document contains data as key-value pairs. • Unique key is assigned for each document, and that key value is help to storage, retrieval & management of that document data. • Ex: CouchDB & MongoDB
  • 7.
    Graph-Based • These databasesuse graph structures to represent and store data. • Nodes representing entities, Edges representing relationships, and Properties providing additional information about nodes and edges. • They are excel at managing and querying complex data relationships. • They are mainly used in the applications like social networks, fraud detection, and recommendation systems. • Ex: Neo4j and OrientDB.
  • 8.
    CouchDB • Open SourceNoSQLDB from Apache Software Foundation. • Document-based one. • Stores data in JSON Format(Java Script Object Notation). Provides, • Easy data handling • Flexible Schema • Each document has a Unique ID & Revision ID for managing Update. • Use RESTful HTTP API to interact with the database. – CURD (Create,Update,Read,Delete) Operations done by the HTTP request GET,POST,PUT & Delete • Uses MapReduce functions to create views and query data. • ACID properties (Atomicity, Consistency, Isolation, Durability) are followed. • Fault-tolerant Storage • Replication is used to achieve fault-tolerant via Master to Master or Master to Slave • IT offers built-in, easy-to-use replication capabilities, enabling synchronization of databases across multiple servers or devices for data distribution, backup, and high availability. • It employs MVCC for optimistic concurrency control, allowing multiple clients to read and write data concurrently without requiring locks on the database.
  • 9.
  • 10.
    CouchDB Communication CouchDB cURLCouchDB Fauxton It is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, TFTP, DICT, TELNET, LDAP or FILE) The cURL utility is available in operating systems such as UNIX, Linux, Mac OS X and Windows. Fauxton is a web-based interface allowing users to create, update, delete, and view documents and design documents. It is a command line utility using which user can access HTTP protocol straight away from the command line. It provides a simple graphical interface,& provides full access to all CouchDB features To access website curl https://google.com/ To get help $ curl ?help or $ curl –help List of cURL utility curl [options] <URL> Options: example -d => send data with HTTP POST -O => write output Database Features: • Create DB • Destroy DB Document Features: • Create • Update • Edit • Delete
  • 11.
    MongoDB • It isa cross-platform, document oriented database that provides, high performance, high availability, and easy scalability. • It works on concept of collection and document. Database • Database is a physical container for collections. • Each database gets its own set of files on the file system. • A single MongoDB server typically has multiple databases. Collection • Collection is a group of MongoDB documents. • It is the equivalent of an RDBMS table. • A collection exists within a single database. • Documents within a collection can have different fields. Document • A document is a set of key-value pairs. • Documents have dynamic schema. • Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection's documents may hold different types of data.
  • 12.
  • 13.
    Features of MongoDB •Document Oriented: MongoDB stores the main subject in the minimal number of documents and not by breaking it into multiple relational structures like RDBMS. • Indexing: Without indexing, a database would have to scan every document of a collection to select those that match the query which would be inefficient. – So, for efficient searching Indexing is must and MongoDB uses it to process huge volumes of data in very less time. • Scalability: MongoDB scales horizontally using sharding (partitioning data across various servers). Data is partitioned into data chunks using the shard key and these data chunks are evenly distributed across shards that reside across many physical servers. Also, new machines can be added to a running database. • Replication and High Availability: MongoDB increases the data availability with multiple copies of data on different servers. By providing redundancy, it protects the database from hardware failures. If one server goes down, the data can be retrieved easily from other active servers which also had the data stored on them. • Aggregation: Aggregation operations process data records and return the computed results. It is similar to the GROUPBY clause in SQL. A few aggregation expressions are sum, avg, min, max, etc.
  • 14.
    CouchDB Vs MongoDB FeatureCouchDB MongoDB Type Document oriented Document oriented Data model Stores data as JSON documents with a unique ID Stores data as BSON documents with ID Storage Append only storage engine MVCC WiredTiger (default), Supports journaling & compression Query Language MapReduce Rich query language, supports CRUD operations Indexing Secondary indexes created Secondary, compound, text indexes & geospatial Replication Master – Master replication with MVCC Master – Slave replication with automatic failover Scalability Peer- to –peer , distributed, offline first systems Sharding for horizontal scaling, designed for large scale high performance apps Transactions Document level ACID properties Multi document ACID transactions Consistency Model Eventual Strong Use Case Offline – first apps Real-time analytics, Big Data, High –performance web apps Performance Slower for complex queries Faster
  • 15.