@indiekitai/pg-dash 0.5.0 โ 0.5.2
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 +45 -0
- package/README.zh-CN.md +8 -0
- package/package.json +1 -1
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
|
|