What is the difference between a B-Tree Index and a Hash Index?
Answer
A B-Tree index keeps keys in a sorted balanced tree structure, supporting range queries, sorting, and inequality operators (<, >, <=, >=). A Hash index relies on a hash table mapping, which executes point lookups extremely fast (= operators) but cannot support range queries or partial index scans.
What is the difference between a Logical View and a Physical View?
Answer
A Physical View describes the actual storage layout, file locations, indexing structures, and hardware organization of data on disk blocks. A Logical View describes how data is structurally presented to application users, abstracting away disk layout using conceptual tables and virtual representations.
What is the difference between Two-Phase Locking (2PL) and Two-Phase Commit (2PC)?
Answer
Two-Phase Locking (2PL) is a concurrency control protocol used within a single database instance to ensure serializability by expanding and contracting lock phases. Two-Phase Commit (2PC) is an atomic distribution protocol ensuring that a transaction commits or aborts across multiple physical nodes in a cluster.
What is the difference between Strong Consistency and Eventual Consistency?
Answer
Strong Consistency guarantees that any read operation immediately following a write returns the newly updated value across all nodes. Eventual Consistency acknowledges updates immediately on one node, while background replication asynchronously synchronizes other replicas, allowing temporary stale reads.
What is the difference between Row-Oriented and Column-Oriented Storage?
Answer
Row-Oriented storage groups all column values of a single record together sequentially on disk, optimizing write-heavy transactional operations (OLTP). Column-Oriented storage packs all values of the same column across all records together, minimizing disk I/O during aggregate analytical operations (OLAP).
What is the difference between Optimistic and Pessimistic Locking?
Answer
Optimistic Concurrency Control checks for modifications right before committing a transaction without acquiring pre-emptive locks, assuming conflicts are rare. Pessimistic locking explicitly locks resources at data access time to block concurrent updates, assuming structural data conflicts are highly frequent.
What is the difference between a Live Lock and a Deadlock?
Answer
A Deadlock occurs when two or more active transactions are stuck in a total standstill because each holds a resource the other needs to proceed. A Live Lock occurs when transactions continuously change their state or repeatedly retry operations in response to each other without making any forward progress.
What is the difference between Sharding and Partitioning?
Answer
Sharding is a horizontal architecture that distributes different subsets of a database table across entirely separate physical server nodes. Partitioning splits a large table into distinct, smaller logical chunks (like by date ranges) managed within a single database instance.
What is the difference between Vertical Scaling and Horizontal Scaling?
Answer
Vertical Scaling (Scaling Up) involves adding more processing resources (RAM, CPU, SSD capacity) to a single database server. Horizontal Scaling (Scaling Out) involves connecting multiple independent database servers together into a distributed system to share the processing load.
Premium Content
Unlock Comparison Questions - Part 2 and all premium lessons with a subscription.
All premium lessons
Ad-free experience
Priority support
From ₹199.99/year — See plans