Closed jonathan-wondereur closed 6 months ago
Hi @jonathan-wondereur, thanks for sharing, but this doesn't seem specific to PgHero.
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
}
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