@indiekitai/pg-dash 0.5.0 โ†’ 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,6 +21,12 @@ npx @indiekitai/pg-dash check postgres://user:pass@host/db
21
21
  # Check migration safety before running it
22
22
  npx @indiekitai/pg-dash check-migration ./migrations/015_add_index.sql
23
23
 
24
+ # EXPLAIN ANALYZE a slow query in the terminal
25
+ npx @indiekitai/pg-dash explain "SELECT * FROM orders WHERE user_id = 1" postgres://...
26
+
27
+ # Real-time lock + long-query monitor (Ctrl+C to exit)
28
+ npx @indiekitai/pg-dash watch-locks postgres://...
29
+
24
30
  # Compare two environments (local vs staging)
25
31
  npx @indiekitai/pg-dash diff-env --source postgres://localhost/db --target postgres://staging/db
26
32
 
@@ -102,6 +108,45 @@ The Dashboard is there when you need it. But the real power is in the CLI, MCP,
102
108
  - Auto-detects Slack vs Discord webhook URLs
103
109
  - Configure via `--slack-webhook` or `--discord-webhook`
104
110
 
111
+ ### ๐Ÿ”ฌ EXPLAIN ANALYZE CLI
112
+
113
+ ```bash
114
+ pg-dash explain "SELECT * FROM orders WHERE user_id = 1" postgres://...
115
+ ```
116
+
117
+ ```
118
+ Query: SELECT * FROM orders WHERE user_id = 1
119
+
120
+ Limit cost=3.01..3.04 actual=0.060ms rows=10/10
121
+ โ””โ”€ Sort cost=3.01..3.09 actual=0.057ms rows=10/32
122
+ โ””โ”€ Seq Scan on users cost=0.00..2.32 actual=0.023ms rows=32/32
123
+
124
+ โ”€โ”€โ”€ Summary โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
125
+ Execution time: 0.087ms
126
+ Planning time: 0.756ms
127
+ Seq Scans: users
128
+
129
+ โ”€โ”€โ”€ Recommendations โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
130
+ โ„น Sort on [created_at DESC]. An index might eliminate this.
131
+ ```
132
+
133
+ - Color-coded node types: ๐Ÿ”ด Seq Scan, ๐ŸŸข Index Scan, ๐ŸŸก Hash Join, ๐ŸŸฃ Sort
134
+ - Shows actual vs estimated rows โ€” catches bad planner estimates
135
+ - Flags Seq Scans > 1000 rows, Sort nodes, Hash Join memory spills
136
+ - `--no-analyze` for dry EXPLAIN (no actual execution)
137
+ - `--json` for scripting
138
+
139
+ ### ๐Ÿ”’ watch-locks
140
+
141
+ ```bash
142
+ pg-dash watch-locks postgres://...
143
+ ```
144
+
145
+ Real-time lock wait monitor โ€” refreshes every 3 seconds. Shows:
146
+ - Blocked queries with PID, wait time, and the blocking query
147
+ - Long-running queries (configurable threshold via `--long-query-threshold`)
148
+ - Table and lock type for each wait
149
+
105
150
  ### ๐Ÿ›ก๏ธ Migration Safety Check
106
151
  - Analyze a migration SQL file for risks before running it
107
152
  - Detects: `CREATE INDEX` without `CONCURRENTLY` (lock risk), `ADD COLUMN NOT NULL` without `DEFAULT`, `ALTER COLUMN TYPE` (full table rewrite), `DROP COLUMN` (app breakage risk), `ADD CONSTRAINT` without `NOT VALID` (full table scan), `CREATE INDEX CONCURRENTLY` inside a transaction (runtime failure), `DROP TABLE`, `TRUNCATE`, `DELETE`/`UPDATE` without `WHERE`
package/README.zh-CN.md CHANGED
@@ -21,6 +21,12 @@ npx @indiekitai/pg-dash check postgres://user:pass@host/db
21
21
  # ๆ‰ง่กŒ migration ๅ‰ๆฃ€ๆŸฅ้ฃŽ้™ฉ
22
22
  npx @indiekitai/pg-dash check-migration ./migrations/015_add_index.sql
23
23
 
24
+ # ็ปˆ็ซฏ้‡Œๅˆ†ๆžๆ…ขๆŸฅ่ฏข๏ผˆๅฝฉ่‰ฒๆ ‘ๅฝข่พ“ๅ‡บ + ๅปบ่ฎฎ๏ผ‰
25
+ npx @indiekitai/pg-dash explain "SELECT * FROM orders WHERE user_id = 1" postgres://...
26
+
27
+ # ๅฎžๆ—ถ้”็›‘ๆŽง๏ผˆCtrl+C ้€€ๅ‡บ๏ผ‰
28
+ npx @indiekitai/pg-dash watch-locks postgres://...
29
+
24
30
  # ๅฏนๆฏ”ไธคไธช็Žฏๅขƒ๏ผˆๆœฌๅœฐ vs ้ข„ๅ‘๏ผ‰
25
31
  npx @indiekitai/pg-dash diff-env --source postgres://localhost/db --target postgres://staging/db
26
32
 
@@ -173,6 +179,8 @@ pg-dash --host localhost --user postgres --db mydb --port 3480
173
179
  pg-dash <connection-string> ๅฏๅŠจ้ขๆฟ
174
180
  pg-dash check <connection-string> ่ฟ่กŒๅฅๅบทๆฃ€ๆŸฅๅนถ้€€ๅ‡บ
175
181
  pg-dash check-migration <file> [conn] ๆฃ€ๆŸฅ migration SQL ็š„้ฃŽ้™ฉ
182
+ pg-dash explain "<query>" <connection> ็ปˆ็ซฏ้‡Œ EXPLAIN ANALYZE ๆŸฅ่ฏข
183
+ pg-dash watch-locks <connection> ๅฎžๆ—ถ้”ๅ’Œ้•ฟๆŸฅ่ฏข็›‘ๆŽง
176
184
  pg-dash diff-env --source <url> --target <url> ๅฏนๆฏ”ไธคไธช็Žฏๅขƒ
177
185
  pg-dash schema-diff <connection-string> ๆ˜พ็คบ Schema ๅ˜ๆ›ด
178
186
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indiekitai/pg-dash",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Lightweight PostgreSQL monitoring dashboard",
5
5
  "type": "module",
6
6
  "bin": {