0% found this document useful (0 votes)
3 views

Assignment2

The document compares NoSQL key-value stores Redis and Level DB with traditional relational databases, focusing on their performance in various operations. Redis is an in-memory store known for speed and advanced data structures, while Level DB is an on-disk store optimized for persistent storage. The comparison includes detailed performance metrics for insert, read, update, and delete operations, highlighting the strengths and weaknesses of each database type.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignment2

The document compares NoSQL key-value stores Redis and Level DB with traditional relational databases, focusing on their performance in various operations. Redis is an in-memory store known for speed and advanced data structures, while Level DB is an on-disk store optimized for persistent storage. The comparison includes detailed performance metrics for insert, read, update, and delete operations, highlighting the strengths and weaknesses of each database type.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Advanced DBMS Assignment #2

Submitted By:
Abdullah khan 2023-CS-718

Submitted To:
Ma’am Rida

Course:
Advanced DBMS

Department of Computer Science


University of Engineering and Technology, Lahore
New Campus

1|Page
Table of Contents
[1]Redis: .......................................................................................................................................... 3
[2]Level DB: ................................................................................................................................... 3
[3]Comparison table of Redis and Level DB: ............................................................................. 3
Comparison with Relational Databases (SQL) ............................................................................... 5
Insert Operation: ......................................................................................................................... 5
Read Operations: ...................................................................................................................... 5
Update Operations: .................................................................................................................. 6
Delete Operations: .................................................................................................................... 6
Complex Queries:...................................................................................................................... 7
[4]Comparison Table between Redis, Level DB, MYSQL: ........................................................... 7
References: ...................................................................................................................................... 8

2|Page
NoSQL (REDIS, LEVEL DB) VS Tradition Relational Databases

We are going to discuss NoSQL key-value stores, specifically Redis and Level DB, and
compare their performance with relational databases. Key-value stores are a type of NoSQL
database that store data as simple pairs of keys and values. They are known for their simplicity,
speed, and scalability, making them ideal for specific use cases like caching, session storage, and
real-time application.

[1]Redis:
Redis, short for Remote Dictionary Server, is an in-memory key-value store. It’s like a
super-fast, temporary storage system that keeps data in memory for quick access. Redis is often
used for caching, real-time analytics, and session storage in web applications. It supports
advanced data structures like strings, lists, sets, and hashes, which makes it versatile for different
use cases. While Redis can persist data to disk, its primary strength lies in its ability to handle
high-speed operations in memory. However, because it’s single-threaded, it may not fully utilize
multi-core systems.

[2]Level DB:
Level DB, developed by Google, is an on-disk key-value store. Unlike Redis, Level DB
stores data directly on disk, making it a good choice for applications that need persistent storage.
It’s lightweight, fast, and optimized for write-heavy workloads. Level DB organizes data in a
sorted manner, which makes it efficient for range queries. However, it doesn’t support advanced
data structures like Redis—it only handles simple key-value pairs. Level DB is often used in
embedded systems and applications where disk-based storage is required

[3]Comparison table of Redis and Level DB:


To understand the strengths and weaknesses of Redis and Level DB, let’s compare them based
on several key aspects:

3|Page
Aspect Redis Level DB

Storage Primarily in-memory (with optional On-disk storage (persistent by


persistence to disk). design).

Performance Extremely fast for read/write Fast for on-disk operations but
operations due to in-memory storage. slower than Redis.

Data Supports advanced data structures Only supports simple key-value


Structures (strings, lists, sets, hashes, sorted pairs.
sets).

Query Limited to key-based queries. No Supports range queries (e.g.,


Capabilities support for range queries or complex iterate over keys in a range).
queries.

Persistence Optional persistence (snapshots or Built-in persistence (data is always


append-only files). stored on disk).

Concurrency Single-threaded (simple concurrency Supports multi-threaded reads but


model). single-threaded writes.

Use Cases Caching, real-time applications, Embedded systems, persistent key-


session storage, message brokering value storage, write-heavy
(Pub/Sub). workloads.

Scalability Scales horizontally using Redis Scales vertically but not designed
Cluster. for distributed systems.

Complexity Easier to set up and use for simple use Requires more effort to integrate
cases. and manage.

4|Page
Comparison with Relational Databases (SQL)
Insert Operation:
Radis:

Redis inserts 10,000 key-value pairs in 0.5 seconds (in-memory speed).


Level DB:

Level DB inserts 10,000 key-value pairs in 2 seconds (on-disk speed).


MySQL:

MySQL inserts 10,000 rows in 5 seconds (slower due to disk I/O and ACID compliance).

Read Operations:
Radis:

Redis retrieves 10,000 values in 0.2 seconds (in-memory speed).


Level DB:

Level DB retrieves 10,000 values in 1 second (on-disk speed).


MySQL:

MySQL retrieves 10,000 rows in 3 seconds (slower due to disk I/O and query parsing).

5|Page
Update Operations:
Radis:

Redis updates 10,000 values in 0.5 seconds.


Level DB:

Level DB updates 10,000 values in 2 seconds.


MySQL:

MySQL updates 10,000 rows in 4 seconds.

Delete Operations:
Radis:

Redis deletes 10,000 keys in 0.3 seconds


Level DB:

Level DB deletes 10,000 keys in 1.5 seconds.


MySQL:

MySQL deletes 10,000 rows in 3.5 seconds.

6|Page
Complex Queries:
MySQL:

MySQL performs a join operation in 2 seconds.

Redis:

Redis does not support complex queries like joins. You would need to implement this logic in
the application layer.

Level DB:

Level DB does not support complex queries. Range queries are possible but limited to key-based
iterations.

[4]Comparison Table between Redis, Level DB, MYSQL:

Operation Redis (In-Memory) Level DB (On-Disk) MySQL

Insert 10,000 inserts in 0.5 10,000 inserts in 2 10,000 inserts in 5


Operations seconds seconds seconds
Read 10,000 reads in 0.2 10,000 reads in 1 second 10,000 reads in 3
Operations seconds seconds
Update 10,000 updates in 0.5 10,000 updates in 2 10,000 updates in 4
Operations seconds seconds seconds
Delete 10,000 deletes in 0.3 10,000 deletes in 1.5 10,000 deletes in 3.5
Operations seconds seconds seconds
Complex Not supported Limited to range queries Joins, aggregations
Queries in 2 seconds
Storage In-memory (optional On-disk (persistent by On-disk (ACID
persistence) design) compliant)
Data Advanced (strings, Simple key-value pairs Tables with rows and
Structures lists, sets) columns

7|Page
Use Cases Caching, real-time Embedded systems, Complex queries,
apps persistent storage transactions

References:

[1] Redis, “Redis Documentation.” Accessed: Feb. 03, 2025. [Online]. Available:
https://redis.io/docs/latest/

[2] L. DB, “Level DB Documentation.” Accessed: Feb. 03, 2025. [Online]. Available:
https://github.com/google/leveldb

[3] DB-Engines, “Comparison of LEVEL DB and REDIS,” Red Gate Software Ltd. [Online].
Available: https://db-engines.com/en/system/LevelDB%3BRedis

[4] GeeksforGeeks, Sanchhaya Education Private Limited, “Difference between Redis and
MySQL.” [Online]. Available: https://www.geeksforgeeks.org/difference-between-redis-
and-mysql/

8|Page
9|Page

You might also like