1 of 13

Introduction to Data Science

By

S.V.V.D.Jagadeesh

Sr. Assistant Professor

Dept of Artificial Intelligence & Data Science

LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING

2 of 13

  • Session Outcomes
  • Introduction to NoSQL
  • NewSQL
  • NoSQL and NewSQL Databases
  • ACID Properties

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Previously Discussed Topics

LBRCE

IDS

3 of 13

At the end of this session, Student will be able to:

  • Understand the CAP theorem which defines the problem with Databases on many nodes(Understand- L2)

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Session Outcomes

LBRCE

IDS

4 of 13

  • The CAP Theorem states that a database can be any two of the following things but never all three:

■ Partition tolerant—The database can handle a network partition or network failure.

■ Available—As long as the node you’re connecting to is up and running and you can connect to it, the node will respond, even if the connection between the different database nodes is lost.

■ Consistent—No matter which node you connect to, you’ll always see the exact same data

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

CAP Theorem

LBRCE

IDS

5 of 13

  • For a single-node database it’s easy to see how it’s always available and consistent:

■ Available—As long as the node is up, it’s available. That’s all the CAP availability promises.

■ Consistent—There’s no second node, so nothing can be inconsistent

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

CAP Theorem

LBRCE

IDS

6 of 13

  • Things get interesting once the database gets partitioned.
  • Then you need to make a choice between availability and consistency.
  • Let’s take the example of an online shop with a server in Europe and a server in the United States, with a single distribution center.
  • A German named Fritz and an American named Freddy are shopping at the same time on that same online shop.
  • They see an item and only one is still in stock: a bronze, octopus-shaped coffee table.

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Partitioned Databases

LBRCE

IDS

7 of 13

  • Disaster strikes, and communication between the two local servers is temporarily down.
  • If you were the owner of the shop, you’d have two options:

■ Availability—You allow the servers to keep on serving customers, and you sort out everything afterward.

■ Consistency—You put all sales on hold until communication is reestablished

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Partitioned Databases

LBRCE

IDS

8 of 13

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Partitioned Databases

LBRCE

IDS

9 of 13

  • In the first case, Fritz and Freddy will both buy the octopus coffee table, because the last-known stock number for both nodes is “one” and both nodes are allowed to sell it

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Partitioned Databases

LBRCE

IDS

10 of 13

  • If the coffee table is hard to come by, you’ll have to inform either Fritz or Freddy that he won’t receive his table on the promised delivery date or, even worse, he will never receive it.
  • As a good businessperson, you might compensate one of them with a discount coupon for a later purchase, and everything might be okay after all.

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Partitioned Databases

LBRCE

IDS

11 of 13

  • The second option involves putting the incoming requests on hold temporarily.
  • This might be fair to both Fritz and Freddy if after five minutes the web shop is open for business again, but then you might lose both sales and probably many more.
  • Web shops tend to choose availability over consistency, but it’s not the optimal choice in all cases.

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Partitioned Databases

LBRCE

IDS

12 of 13

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Partitioned Databases

LBRCE

IDS

13 of 13

  • Session Outcomes
  • CAP Theorem
  • Partitioned Databases

S.V.V.D.Jagadeesh

Wednesday, March 5, 2025

Summary

LBRCE

IDS