PgHero
No long running queries
Connections healthy 7
Vacuuming healthy
No columns near integer overflow
No invalid indexes or constraints
No duplicate indexes
1 suggested index
No slow queries

Suggested Indexes

Add indexes to speed up queries.

rails generate migration add_suggested_indexes

And paste

commit_db_transaction
add_index :pghero_space_stats, [:relation, :captured_at], algorithm: :concurrently

Details
CREATE INDEX CONCURRENTLY ON pghero_space_stats (relation, captured_at)
Rows: 3456471
Row progression: 3456471, 709, 71

Row estimates
- relation (=): 709
- captured_at (>=): 346134
- schema (=): 1728236
- database (=): 3456471

Existing indexes
- id PRIMARY
- database, captured_at

to speed up

Total Time Average Time Calls
0 min 4% 51 ms 94 pghero · details
SELECT captured_at, size AS size_bytes FROM pghero_space_stats WHERE database = $1 AND captured_at >= $2 AND schema = $3 AND relation = $4 ORDER BY 1 ASC /*pghero*/