ankane / pghero

A performance dashboard for Postgres
MIT License
8.16k stars 452 forks source link

Upgrading PGSQL Version #494

Closed jonathan-wondereur closed 6 months ago

jonathan-wondereur commented 6 months ago

When updating my database from PGSQL from version 12 to 15 I was getting errors, I only noticed the errors because of Sentry.

To resolve this I just needed to restart my Ruby on Rails server, but this is not something that is mentioned in the docs.

Thanks, Jonathan

ankane commented 6 months ago

Hi @jonathan-wondereur, thanks for sharing, but this doesn't seem specific to PgHero.

jonathan-wondereur commented 6 months ago

Sorry, I forgot to include details of the error:

PG::UndefinedColumn: ERROR:  column "total_time" does not exist (PG::UndefinedColumn)
LINE 1: ...S query, queryid AS query_hash, rolname AS user, (total_time...
{
name: null,
sql: WITH query_stats AS ( SELECT LEFT(query, 10000) AS query, queryid AS query_hash, rolname AS user, (total_time / 1000 / 60) AS total_minutes, (total_time / calls) AS average_time, calls FROM pg_stat_statements INNER JOIN pg_database ON pg_database.oid = pg_stat_statements.dbid INNER JOIN pg_roles ON pg_roles.oid = pg_stat_statements.userid WHERE calls > 0 AND pg_database.datname = current_database() ) SELECT query, query AS explainable_query, query_hash, query_stats.user, total_minutes, average_time, calls, total_minutes * 100.0 / (SELECT SUM(total_minutes) FROM query_stats) AS total_percent, (SELECT SUM(total_minutes) FROM query_stats) AS all_queries_total_minutes FROM query_stats ORDER BY "total_minutes" DESC LIMIT 100 /*pghero*/,
statement_name: null
}
ankane commented 6 months ago

Check out https://github.com/ankane/pghero/blob/master/guides/Query-Stats.md#error-column-total_plan_time--queryid-does-not-exist