Skip to content

Commit 370a166

Browse files
committed
v1.2 release notes
1 parent 673097e commit 370a166

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

RELEASE_NOTES.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,97 @@
1+
# pg_ash 1.2 release notes
2+
3+
51 commits since v1.1. Upgrade from 1.1: `\i sql/ash-1.1-to-1.2.sql`. Fresh install or upgrade from any version: `\i sql/ash-install.sql`.
4+
5+
## What changed
6+
7+
### New: event_queries
8+
9+
`event_queries()` and `event_queries_at()` — find which queries are responsible for a specific wait event. Flexible matching: `'Lock:tuple'` (exact event), `'IO'` (all events of a type), or `'CPU*'` (synthetic). Includes bar column.
10+
11+
```sql
12+
-- which queries are causing Lock:tuple?
13+
select * from ash.event_queries('Lock:tuple', '1 hour');
14+
15+
-- all IO-related queries in a time window
16+
select * from ash.event_queries_at('IO', '2026-02-17 14:00', '2026-02-17 14:05');
17+
```
18+
19+
### New: session-level color toggle
20+
21+
Enable ANSI colors for the whole session without passing `p_color` to every call:
22+
23+
```sql
24+
set ash.color = on;
25+
select * from ash.top_waits('1 hour');
26+
select * from ash.timeline_chart('1 hour');
27+
```
28+
29+
Uses a custom GUC — works on any Postgres 9.2+ without `postgresql.conf` changes. `ash.status()` now shows the current color state.
30+
31+
### New: bar visualization on all wait-showing functions
32+
33+
Every function that shows `pct` now has a `bar` column — `query_waits`, `top_by_type`, `event_queries` (plus all `_at` variants). Bar width controlled by `p_width` (default 20), colors by `p_color` or `set ash.color = on`.
34+
35+
### Changed: waits_by_type renamed to top_by_type
36+
37+
Consistent naming with `top_waits`, `top_queries`. The old name is dropped on install/upgrade.
38+
39+
### Changed: top_queries_with_text columns
40+
41+
`mean_time_ms` renamed to `mean_exec_time_ms`. New column `total_exec_time_ms` added.
42+
43+
### Improved: pspg-compatible bar alignment
44+
45+
ANSI color escapes are zero-padded to uniform 19-byte length (`\033[38;2;080;250;123m` not `\033[38;2;80;250;123m`). The `_bar()` helper pads the full bar string to a fixed raw byte length, preventing right-border misalignment in pspg and similar tools.
46+
47+
### Improved: timeline_chart shows empty buckets
48+
49+
Quiet periods now show rows with `active = 0` instead of being omitted, so you can see the full time range.
50+
51+
### Improved: observer-effect protection
52+
53+
The sampler pg_cron command now includes `SET statement_timeout = '500ms'` to prevent `take_sample()` from becoming a problem on overloaded servers. The 500ms cap gives 10× headroom over normal ~50ms execution. Existing cron jobs are updated automatically on upgrade.
54+
55+
### Improved: version tracking
56+
57+
`ash.config` now has a `version` column. `ash.status()` shows it as the first metric. The install and migration files set it automatically.
58+
59+
### Improved: dynamic overload cleanup
60+
61+
`ash-install.sql` discovers and drops all stale function overloads by name, making it safe to run on any prior version without "function is not unique" errors.
62+
63+
### Fixed: event_queries crash without pg_stat_statements
64+
65+
Both `event_queries()` and `event_queries_at()` would crash on Postgres instances without `pg_stat_statements` loaded — the table reference was validated at plan time even in the `false` branch. Split into two `RETURN QUERY` branches.
66+
67+
### Fixed: IdleTx color in top_by_type
68+
69+
`top_by_type()` passed `'IdleTx:*'` to `_wait_color()` which used exact match. Changed to `LIKE 'IdleTx%'`.
70+
71+
### Fixed: upgrade path completeness
72+
73+
`start()` and `status()` are now re-created in the 1.1→1.2 migration, ensuring upgraded installs get the statement_timeout protection and color/version metrics.
74+
75+
## Functions (37 total)
76+
77+
| Function | Description |
78+
|---|---|
79+
| `event_queries(event, interval, limit, width, color)` | **New** — top queries for a wait event |
80+
| `event_queries_at(event, start, end, limit, width, color)` | **New** — absolute-time variant |
81+
| `_bar(event, pct, max_pct, width, color)` | **New** — shared bar rendering helper |
82+
| `_color_on(color)` | **New** — resolve effective color state (param or session GUC) |
83+
| `top_by_type(interval, width, color)` | **Renamed** from `waits_by_type` — now with bar |
84+
| `top_by_type_at(start, end, width, color)` | **Renamed** from `waits_by_type_at` — now with bar |
85+
| `query_waits(query_id, interval, width, color)` | **Enhanced** — added bar column |
86+
| `query_waits_at(query_id, start, end, width, color)` | **Enhanced** — added bar column |
87+
| `top_queries_with_text(interval, limit)` | **Enhanced** — renamed/added columns |
88+
| `start(interval)` | **Enhanced** — statement_timeout in cron command |
89+
| `status()` | **Enhanced** — shows version, color state |
90+
91+
All other functions unchanged from 1.1. See README for the full reference.
92+
93+
---
94+
195
# pg_ash 1.1 release notes
296

397
Upgrade from 1.0: `\i sql/ash-1.1.sql` — safe to run on top of a running 1.0 installation.

0 commit comments

Comments
 (0)