Posts

Showing posts with the label pgbouncer

Scaling strategies

Image
Introduction Scaling strategies in PostgreSQL are methods that help the database handle larger volumes of data, support high user concurrency and maintain high performance. These strategies are divided into the following main groups: In-Database Scaling First, you should choose Data & Structure Optimization solutions right within the Database , which saves resources and avoids incurring costs associated with upgrading hardware or purchasing additional servers. Table Partitioning Divide a massive table (hundreds of millions of rows) into smaller tables by Range, List, or Hash . Example: Divide the orders table by month. Postgres only needs to scan the exact partition containing the required data (Partition Pruning). Indexing : Use the correct index types such as B-Tree (default), GIN (for JSONB/Full-text search) and BRIN (for large time-series data) to accelerate query speeds. Vacuuming : Configure optimized Autovacuum to clean up Dead Tuples , avoiding Table Bloat that inflates d...

Overhead in PostgreSQL

Image
Introduction In computer science and systems engineering, overhead is not a bug, but it is a phenomenon of system resource waste. Overhead is the amount of time, memory, bandwidth or CPU power consumed to manage or operate the system, rather than contributing directly to the actual data processing results. In database management systems, overhead occurs very frequently. Especially, if the system suffers from excessive memory (RAM) overhead, the Operating System (OS) will trigger a mechanism to kill that process to save the server. Common Types of Overhead in Postgres Postgres has a process-based architecture, meaning each client connection generates an independent process, so it easily encounters the following types of overhead: Connection Overhead: If you have 500 concurrent connections, Postgres will create 500 processes. The fact that the CPU must constantly context switch among these 500 processes creates a massive amount of overhead, significantly reducing performance. Memory Over...