PGSimCity is a web application that provides a 3D visualization of PostgreSQL's architecture, allowing users to explore its internal operations during SQL query execution. The application features an interactive interface that guides users through the connection process to PostgreSQL, illustrating how client connections reach the Postmaster and backend processes. It highlights the significance of connection pooling and the impact of increasing connections on backend processes.
In the 'Query Lab' section, SQL statements are transformed into execution plans, showcasing processes like Parser, Rewriter, Planner, and Executor, along with execution paths such as Seq Scan and Index Scan. The shared_buffers area represents PostgreSQL's buffer cache, optimizing performance by reading data in 8KiB pages.
Visualizations depict data pages stored on disk, with pathways showing the movement of pages to shared_buffers. The Write-Ahead Log (WAL) mechanism records changes for recovery, and transaction commits wait for WAL records to be flushed. Checkpointing writes dirty pages to storage in batches, which can cause latency spikes. PostgreSQL uses Multi-Version Concurrency Control (MVCC) to manage updated rows and dead tuples, which are cleaned up by autovacuum processes.
The application also illustrates replication, where WAL from the primary server is sent to the standby server to maintain data consistency. Overall, PGSimCity provides a comprehensive view of PostgreSQL's components and potential performance issues related to caching, WAL management, checkpointing, vacuuming, and replication.