lecture 8
32 Questions
6 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is a key characteristic of a columnar database?

  • It supports a fixed schema for all rows.
  • Data can be stored in a flexible schema. (correct)
  • Data is stored in rows only.
  • It always requires indexing for speed.

In a graph database, what does a node represent?

  • A data type constraint.
  • A relationship to another node.
  • An entity that can contain properties. (correct)
  • A data record from a table.

Which of the following databases is NOT an example of a columnar database?

  • MySQL (correct)
  • Amazon SimpleDB
  • HBase
  • Cassandra

What aspect of NoSQL databases might encourage their usage?

<p>Need for high data availability. (A)</p> Signup and view all the answers

What is one of the primary benefits of using a relational database?

<p>Consistency (D)</p> Signup and view all the answers

Which of the following best describes a key-value database?

<p>Uses a simple hash table for data storage (D)</p> Signup and view all the answers

What is typically used to describe the connection between two nodes in a graph database?

<p>Relationships (B)</p> Signup and view all the answers

How does Redis primarily differ from traditional disk-based databases?

<p>It performs in-memory operations (A)</p> Signup and view all the answers

Why might columnar databases be less optimal for insert operations?

<p>Performance metrics for writes are typically lower. (B)</p> Signup and view all the answers

Which statement best describes the nature of NoSQL databases?

<p>They simplify data models for better generalizability (D)</p> Signup and view all the answers

How does data compression benefit a columnar database?

<p>Optimizes storage efficiency. (D)</p> Signup and view all the answers

What is a significant advantage of using Redis as a key-value database?

<p>Multiple data structures for efficiency (D)</p> Signup and view all the answers

Which of the following terms is commonly associated with graph algorithms?

<p>Traversal (A)</p> Signup and view all the answers

What feature does a document database offer compared to a relational database?

<p>Storage of heterogeneous metadata (A)</p> Signup and view all the answers

Which operation is NOT typically associated with a key-value store like Redis?

<p>Performing complex queries with joins (D)</p> Signup and view all the answers

What primary challenge does a traditional relational database face in big data environments?

<p>Scalability and partitioning (D)</p> Signup and view all the answers

Which statement accurately describes the indexing method used in MongoDB?

<p>Indexes in MongoDB can contain multiple keys for optimization. (D)</p> Signup and view all the answers

What is a significant limitation of MongoDB regarding transactions?

<p>MongoDB is not suitable for heavy and complex transaction systems. (A)</p> Signup and view all the answers

In MongoDB, which of the following is the correct method to delete a specific document matching a criterion?

<p>db.collection_name.remove() (D)</p> Signup and view all the answers

How does MongoDB handle data partitioning?

<p>Data is distributed through automated range-based partitioning. (A)</p> Signup and view all the answers

What is the default behavior when inserting a document in MongoDB if the '_id' field is omitted?

<p>MongoDB generates a unique key for the document. (B)</p> Signup and view all the answers

Which of the following best describes the data structure used in MongoDB as opposed to traditional relational databases?

<p>MongoDB organizes data into collections and documents instead of rows and columns. (A)</p> Signup and view all the answers

What is the purpose of the '_id' field in MongoDB?

<p>It serves as a primary key for document identification. (B)</p> Signup and view all the answers

Which of the following operations can be performed through the MongoDB API?

<p>Performing atomic updates and consistent reads. (C)</p> Signup and view all the answers

What type of database is characterized by no relation schema and is often used to store data in JSON, BSON, or XML documents?

<p>Document Database (C)</p> Signup and view all the answers

Which of the following represents a potential reason not to migrate from SQL to NoSQL?

<p>Existing SQL structure is sufficient (A)</p> Signup and view all the answers

In the context of SQL to NoSQL migration, which scheme is the most popular?

<p>1-1 mapping scheme (A)</p> Signup and view all the answers

When is it advisable to design a NoSQL solution from the beginning rather than migrating from SQL?

<p>When dramatic application changes are required (B)</p> Signup and view all the answers

What is a disadvantage of using SQL databases compared to NoSQL databases during data assembly?

<p>More data assembling and disassembling required (A)</p> Signup and view all the answers

Which item is NOT commonly associated with a document database?

<p>Use of relational tables (C)</p> Signup and view all the answers

Which of the following is a potential benefit of using a document database?

<p>Reduced need for translation (D)</p> Signup and view all the answers

What describes the data structure format used in document databases?

<p>Flexible and schema-less (A)</p> Signup and view all the answers

Flashcards

Relational Databases

Databases that organize data into tables with relationships between them.

NoSQL Databases

Databases that don't use the traditional table-based structure of relational databases.

Key-Value Database

A simple NoSQL database that stores data as key-value pairs.

Redis

A popular key-value database known for speed and flexibility.

Signup and view all the flashcards

Document Database

A NoSQL database that stores data in documents, like JSON objects.

Signup and view all the flashcards

GET (database operation)

Retrieving the value associated with a given key.

Signup and view all the flashcards

SET (database operation)

Storing a value associated with a given key.

Signup and view all the flashcards

DEL (database operation)

Deleting data corresponding to a key value pair.

Signup and view all the flashcards

NoSQL vs Relational Database

NoSQL databases are better for storing and working with data that can't be easily represented in rows and columns, in contrast to relational database.

Signup and view all the flashcards

SQL to NoSQL Migration

Converting data from a SQL database to a NoSQL database.

Signup and view all the flashcards

1-1 Mapping (Migration)

A SQL structure is simply represented in the NoSQL equivalent.

Signup and view all the flashcards

Denormalization (for Migration)

Reverting to a less normalized data model, moving from a detailed to broader structure, for efficient searching.

Signup and view all the flashcards

JSON Data in Database

Using JSON format to structure data stored in a document database.

Signup and view all the flashcards

MongoDB

A document-oriented, NoSQL database, founded in 2007, written in C++.

Signup and view all the flashcards

Document-oriented DB

Stores data in documents, each containing key-value pairs.

Signup and view all the flashcards

CRUD Operations (MongoDB)

Create, Read, Update, and Delete operations in MongoDB.

Signup and view all the flashcards

Insert (MongoDB)

Adding a new document to a collection.

Signup and view all the flashcards

Find (MongoDB)

Retrieving documents from a collection that match a specific criteria.

Signup and view all the flashcards

Update (MongoDB)

Modifying existing documents in a collection.

Signup and view all the flashcards

Delete (MongoDB)

Removing documents from a collection.

Signup and view all the flashcards

Columnar Database

A database where data is organized by columns instead of rows. Each column is stored separately, allowing for efficient querying and data compression.

Signup and view all the flashcards

Columnar Database Benefits

Columnar databases offer advantages such as efficient data compression due to storing similar data together, faster queries by focusing on specific columns, and self-indexing capabilities.

Signup and view all the flashcards

Graph Database

A database designed to store and query data with relationships between entities. Each node represents an entity, and edges represent relationships between them.

Signup and view all the flashcards

Node in a Graph Database

A representation of an entity in a graph database. Nodes can have properties that store information about the entity.

Signup and view all the flashcards

Relationship in a Graph Database

A connection between two nodes in a graph database. Relationships can have types (like 'FRIENDS' or 'WORKED_WITH') and properties.

Signup and view all the flashcards

Graph Database Advantages

Graph databases excel at analyzing interconnected data, offering efficient traversal of relationships, and supporting the application of graph algorithms.

Signup and view all the flashcards

When to Use NoSQL

NoSQL databases are advantageous when you need flexibility, scalability, and high availability, especially when dealing with large datasets and diverse data sources.

Signup and view all the flashcards

ACID Properties

In traditional databases, ACID properties (Atomicity, Consistency, Isolation, Durability) ensure data integrity and reliability. NoSQL databases may compromise some of these for performance.

Signup and view all the flashcards

Study Notes

INF2003: Database Systems NoSQL AY24/25 Trimester 1

  • Course offered by Singapore Institute of Technology (SIT)
  • Presented by Zhang Wei on November 5, 2024

Relational DB: Advantages and Gap

  • Benefits:
    • Consistency, concurrency, recovery
    • Matematical background, solid and rigorous
    • SQL for management and communication
    • Mature ecosystem with tools and services
    • Fact: MySQL database is centralized, stored on a single disk.
  • Good points:
    • Fast local joins, easy management
  • Bad points:
    • Scalability/partitioning issues
    • Robustness/replication problems
    • Task dispatching challenges
  • Reality:
    • Big data handling, Geo-distribution, and data diversity

NoSQL

  • Goal: Simplify data models for wider use cases.
  • Features:
    • Diverse data types and locations
  • Types:
    • Key-value: Simplest NoSQL, a hash table with key-value pairs. Example: Redis.
  • Store, retrieve values in O(1) time
  • Support for data structures (Strings, hashes, lists, sets etc)
  • In-memory operations for speed
  • Data persistency to disk for reliability
  • Many languages supported (Python, Java, C#, C++, etc.)
    • Document:
  • Handles heterogeneous metadata
  • Suitable for storing items (e.g., Lazada/Shopee products) - Not suitable for relational database
    • Columnar:
  • Data stored in columns, not rows
  • Flexible schema design
  • Data compression
  • Examples: HBase, Cassandra, Hypertable, Amazon SimpleDB, etc.
    • Graph:
  • Explicit graph structure
  • Each node knows its adjacent nodes
  • Suitable for applications with native graph structure (social networking)
  • Easily applies graph algorithms
  • Node: Contains properties
  • Relationship: Connects two nodes (e.g., acted_in)
  • Property: Named values (e.g., 'name', 'Tom Hanks')
  • Label: Type of node (e.g., person)

MongoDB

  • Founded in 2007
  • Document-oriented NoSQL database
  • Written in C++
  • Hash-based schema-less database
  • Uses strings for keys
  • Document identifiers are automatically generated
  • Supports various programming languages (Javascript, Python)
  • Features: secondary indexes, atomic writes, master-slave replication, automatic failover, horizontal scaling
  • No joins (using scripts)

SQL -> NoSQL Migration

  • Possible reasons: Business scale-up, application changes
  • Scheme 1 (1:1 mapping): Most popular, translate SQL table to NoSQL collections
    • Tools like AWS DMS, Python libraries available
    • Sample code readily available
  • Scheme 2 (Denormalization): Decompose to bigger structures
  • Scheme 3 (Forget migration): Start from scratch with a new design (better for major app changes)

Columnar Databases

  • Database as key-value pairs
  • Key is comprised of 3 parts: row key, column key & timestamp
  • Data stored column-wise
  • Flexible schema
  • Data compression
  • Examples: HBase, Cassandra, Hypertable

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

nosql

More Like This

Data Management and NoSQL Systems Quiz
99 questions
NoSQL Database Introduction Quiz
21 questions
Introducción a bases de datos NoSQL
10 questions
Types of Databases Overview
12 questions
Use Quizgecko on...
Browser
Browser