0% found this document useful (0 votes)
94 views10 pages

Transaction Processing & NoSQL Guide

Transaction Processing Systems document discusses transaction processing systems and their key components. It covers topics like transactions, transaction operations, transaction states, desirable properties of transactions like ACID, schedules and conflicts, and types of schedules like serial and parallel.

Uploaded by

Fake Account
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views10 pages

Transaction Processing & NoSQL Guide

Transaction Processing Systems document discusses transaction processing systems and their key components. It covers topics like transactions, transaction operations, transaction states, desirable properties of transactions like ACID, schedules and conflicts, and types of schedules like serial and parallel.

Uploaded by

Fake Account
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Transaction Processing Systems

A transaction is a program including a collection of database operations, executed as a logical unit of data processing. The
operations performed in a transaction include one or more of database operations like insert, delete, update or retrieve data. It
is an atomic process that is either performed into completion entirely or is not performed at all. A transaction involving only
data retrieval without any data update is called read-only transaction.

Each high level operation can be divided into a number of low level tasks or operations. For example, a data update operation
can be divided into three tasks −

 read_item() − reads data item from storage to main memory.


 modify_item() − change value of item in the main memory.
 write_item() − write the modified value from main memory to storage.

Database access is restricted to read_item() and write_item() operations. Likewise, for all transactions, read and write forms
the basic database operations.
Transaction Operations

The low level operations performed in a transaction are −

 begin_transaction − A marker that specifies start of transaction execution.

 read_item or write_item − Database operations that may be interleaved with main memory operations as a part of
transaction.

 end_transaction − A marker that specifies end of transaction.

 commit − A signal to specify that the transaction has been successfully completed in its entirety and will not be undone.

 rollback − A signal to specify that the transaction has been unsuccessful and so all temporary changes in the database are
undone. A committed transaction cannot be rolled back.
Transaction States

 Active − The initial state where the transaction enters is the active state. The transaction remains in this state while it is
executing read, write or other operations.
 Partially Committed − The transaction enters this state after the last statement of the transaction has been executed.
 Committed − The transaction enters this state after successful completion of the transaction and system checks have issued
commit signal.
 Failed − The transaction goes from partially committed state or active state to failed state when it is discovered that normal
execution can no longer proceed or system checks fail.
 Aborted − This is the state after the transaction has been rolled back after failure and the database has been restored to its
state that was before the transaction began.

The following state transition diagram depicts the states in the transaction and the low level transaction operations that causes
change in states.
Desirable Properties of Transactions

Any transaction must maintain the ACID properties, viz. Atomicity, Consistency, Isolation, and Durability.

 Atomicity − This property states that a transaction is an atomic unit of processing, that is, either it is performed in its entirety
or not performed at all. No partial update should exist.
 Consistency − A transaction should take the database from one consistent state to another consistent state. It should not
adversely affect any data item in the database.
 Isolation − A transaction should be executed as if it is the only one in the system. There should not be any interference from
the other concurrent transactions that are simultaneously running.
 Durability − If a committed transaction brings about a change, that change should be durable in the database and not lost in
case of any failure.

Schedules and Conflicts

In a system with a number of simultaneous transactions, a schedule is the total order of execution of operations. Given a
schedule S comprising of n transactions, say T1, T2, T3………..Tn; for any transaction Ti, the operations in Ti must execute as
laid down in the schedule S.
Types of Schedules

•Serial Schedules − In a serial schedule, at any point of time, only one transaction is active, i.e. there is no overlapping of
transactions. This is depicted in the following graph −

•Parallel Schedules − In parallel schedules, more than one transactions are active simultaneously, i.e. the transactions contain
operations that overlap at time. This is depicted in the following graph −
Serializability

A serializable schedule of ‘n’ transactions is a parallel schedule which is equivalent to a serial schedule comprising of the
same ‘n’ transactions. A serializable schedule contains the correctness of serial schedule while ascertaining better CPU
utilization of parallel schedule.

Equivalence of Schedules

Equivalence of two schedules can be of the following types −

 Result equivalence − Two schedules producing identical results are said to be result equivalent.

 View equivalence − Two schedules that perform similar action in a similar manner are said to be view equivalent.

 Conflict equivalence − Two schedules are said to be conflict equivalent if both contain the same set of transactions and has
the same order of conflicting pairs of operations.
Introduction to NoSQL
NoSQL Database is used to refer a non-SQL or non relational database.
It provides a mechanism for storage and retrieval of data other than tabular relations model used in relational databases. NoSQL
database doesn't use tables for storing data. It is generally used to store big data and real-time web applications.

NoSQL is a type of database management system (DBMS) that is designed to handle and store large volumes of unstructured and
semi-structured data. Unlike traditional relational databases that use tables with pre-defined schemas to store data, NoSQL
databases use flexible data models that can adapt to changes in data structures and are capable of scaling horizontally to handle
growing amounts of data.

The term NoSQL originally referred to “non-SQL” or “non-relational” databases, but the term has since evolved to mean “not
only SQL,” as NoSQL databases have expanded to include a wide range of different database architectures and data models.

We know that MongoDB is a NoSQL Database, so it is very necessary to know about NoSQL Database to understand MongoDB
thoroughly.

Databases can be divided in 3 types:

 RDBMS (Relational Database Management System)


 OLAP (Online Analytical Processing)
 NoSQL (recently developed database)
Advantages of NoSQL

 It supports query language.


 It provides fast performance.
 It provides horizontal scalability.

MongoDB advantages over RDBMS

In recent days, MongoDB is a new and popularly used database. It is a document based, non relational database provider.

Although it is 100 times faster than the traditional database but it is early to say that it will broadly replace the traditional
RDBMS. But it may be very useful in term to gain performance and scalability.

A Relational database has a typical schema design that shows number of tables and the relationship between these tables, while
in MongoDB there is no concept of relationship.
MongoDB Advantages

 MongoDB is schema less. It is a document database in which one collection holds different documents.
 There may be difference between number of fields, content and size of the document from one to other.
 Structure of a single object is clear in MongoDB.
 There are no complex joins in MongoDB.
 MongoDB provides the facility of deep query because it supports a powerful dynamic query on documents.
 It is very easy to scale.
 It uses internal memory for storing working sets and this is the reason of its fast access.

Distinctive features of MongoDB

 Easy to use
 Light Weight
 Extremely faster than RDBMS

Where MongoDB should be used

 Big and complex data


 Mobile and social infrastructure
 Content management and delivery
 User data management
 Data hub
Performance analysis of MongoDB and RDBMS

 In relational database (RDBMS) tables are using as storing elements, while in MongoDB collection is used.
 In the RDBMS, we have multiple schema and in each schema we create tables to store data while, MongoDB is a document
oriented database in which data is written in BSON format which is a JSON like format.
 MongoDB is almost 100 times faster than traditional database systems.

MongoDB Datatypes Data Types Description


String String is the most commonly used datatype. It is used to store data. A string must be UTF 8 valid
in mongodb.
Integer Integer is used to store the numeric value. It can be 32 bit or 64 bit depending on the server you
are using.
Boolean This datatype is used to store boolean values. It just shows YES/NO values.

Double Double datatype stores floating point values.


Min/Max This datatype compare a value against the lowest and highest elements.
Keys
Arrays This datatype is used to store a list or multiple values into a single key.

Object Object datatype is used for embedded documents.


Null It is used to store null values.
Symbol It is generally used for languages that use a specific type.
Date This datatype stores the current date or time. It makes you possible to specify your own date
time by creating object of date and pass the value of date, month, year into it.

You might also like