Trade-offs in Databases

Explore the pros and cons of centralized and distributed databases, and query optimization in distributed databases.

Which is the best database sharding approach?

Both horizontal and vertical sharding involve adding resources to our computing infrastructure. Our business stakeholders must decide which is suitable for our organization. We must scale our resources accordingly for our organization and business to grow, to prevent downtime, and to reduce latency. We can scale these resources through a combination of adjustments to CPU, physical memory requirements, hard disk adjustments, and network bandwidth.

The following sections explain the pros and cons of centralized and distributed databases:

Advantages and disadvantages of a centralized database

Advantages

  • Data maintenance, such as updating and taking backups of a centralized database, is easy.

  • Centralized databases provide stronger consistency and ACID transactions than distributed databases.

  • Centralized databases provide a much simpler programming model for the end programmers as compared to distributed databases.

  • It’s more efficient for businesses that have a small amount of data to store that can reside on a single node.

Disadvantages

  • A centralized database can slow down, causing high latency for end users, when the number of queries per second accessing the centralized database is approaching single-node limits.

  • A centralized database has a single point of failure. Because of this, its probability of not being accessible is much higher.

Advantages and disadvantages of a distributed database

Advantages

  • It’s fast and easy to access data in a distributed database because data is retrieved from the nearest database shard or the one frequently used.

  • Data with different ...