Reducing postgreSQL read and write latencies through optimized fillfactor and hot percentages for high-update applications

Murali Natti *

Lead Database Engineer | DevOps Lead | Database Architect | Cloud Infrastructure Solutions Expert | DB Security Lead
 
Review
International Journal of Science and Research Archive, 2023, 09(02), 1059-1062.
Article DOI: 10.30574/ijsra.2023.9.2.0657
Publication history: 
Received on 02 July 2023; revised on 20 August 2023; accepted on 23 August 2023
 
Abstract: 
In PostgreSQL, optimizing performance [1] for high-transaction, high-update applications is crucial for maintaining low latency and high throughput. One of the primary challenges faced in these environments is the default behavior of PostgreSQL, which can lead to row migration, the accumulation of dead tuples, and increased vacuum overhead due to frequent updates to the same rows. When data is updated frequently, PostgreSQL typically writes updated rows into new locations, which can result in row migration and the creation of "dead tuples" (old versions of rows that are no longer needed). This can slow down database performance because the system has to manage and clean up these dead tuples, which requires additional processing time and resources. Furthermore, PostgreSQL’s vacuum process, which is responsible for cleaning up these dead tuples, can add significant overhead, especially during peak transaction times. This paper proposes a performance-tuning strategy aimed at addressing these challenges by optimizing PostgreSQL’s fillfactor and Heap-Only Tuple (HOT) percentages. The fillfactor determines how much space is left in each data page for future updates, and by adjusting it to leave more space, we reduce the need for row migration. Additionally, by maximizing the efficiency of HOT updates—updates that allow changes to be made within the same data block rather than creating new tuples and moving them—we significantly reduce the overhead caused by dead tuples and row migration. By leveraging these two adjustments, this strategy leads to significant reductions in both read and write latencies, improving query performance and overall application responsiveness. This approach is particularly beneficial for applications with high-frequency updates, such as real-time data systems, where data is frequently modified, and transactional workloads, where consistent, low-latency performance is essential. In these environments, even small performance improvements can have a substantial impact on system efficiency and user experience. By focusing on reducing the time spent managing dead tuples and minimizing the need for row migration, PostgreSQL can be tuned to provide better performance and scalability in high-update, high-transaction settings.
 
Keywords: 
Postgresql; Fillfactor; Heap-Only Tuples (HOT); Write Latency; Query Performance; High-Update Applications; Vacuum Overhead; Database Optimization
 
Full text article in PDF: