liveBook · Manning

Sequence

As explained in PostgreSQL Mistakes and How to Avoid Them

Time-series data consists of observations associated with timestamps or other ordered points in time.

Sequential data associates observations with timestamps or another ordering. In PostgreSQL monitoring, repeated statistics snapshots create time-series data that can be analyzed across changing system conditions. section 7.5

A practical PostgreSQL workflow turns sequential observations into usable operational evidence:

  • Collect snapshots covering metrics such as cache hit ratio, connections, I/O, locks, wait events, WAL generation, and transactions. section 7.5
  • Store the snapshots in database tables and resample them when thousands or millions of observations would be too numerous to plot directly. section 7.5
  • Schedule regular collection with an operating-system or database scheduler, including pg_cron, so changes remain visible over time. section 7.5

Monitoring locks over time

pg_statviz can visualize the mean number and type of database locks from snapshots taken every minute over several months. This makes sequential lock observations easier to inspect as a trend rather than as isolated readings. section 7.5

Figure 7.1 pg_statviz locks analysis output. This visualization displays the mean number and type of locks in the database, with snapshots taken every minute over a period of several months in 2024.
figure

Use the locks-analysis visualization to inspect how lock counts and types change across a long sequence of timestamped snapshots. section 7.5

How PostgreSQL Mistakes and How to Avoid Them covers it

How deep it goes
Explains snapshot collection, database storage, resampling, scheduling, and visualization through a practical tool workflow.
Examples
Uses locks, buffer statistics, WAL, connections, I/O, and other PostgreSQL metrics collected as timestamped snapshots.
What you can do after
Operate/configure pg_statviz to collect scheduled snapshots, resample them, and generate visualizations.
How it connects
Connects sequential data with PostgreSQL statistics, monitoring, resampling, scheduling, and visualization.

Also explained in

Compare how 22 books explain sequence →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of PostgreSQL Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.