Getting truncated queries from pg_stat_statements - Mailing list pgsql-general

From Tim Uckun
Subject Getting truncated queries from pg_stat_statements
Date
Msg-id CAGuHJrO2viJCiETi9EGBxKL+_1tMSYOtq9HRf5EQHY+HC3idbQ@mail.gmail.com
Whole thread Raw
Responses Re: Getting truncated queries from pg_stat_statements
List pgsql-general
I am trying to get some slow query information and the results from my query are truncated at 2047 characters.   Some of my queries are very long so they get truncated in the select. Is there a way around this?

Here is my query.

WITH query_stats AS (
            SELECT
              query::text,
              (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
            WHERE
              pg_database.datname = current_database()
          )
          SELECT
            query,
            total_minutes,
            average_time,
            calls,
            total_minutes * 100.0 / (SELECT SUM(total_minutes) FROM query_stats) AS total_percent
          FROM
            query_stats
          WHERE
            calls >= 10
            AND average_time >= 20
          ORDER BY
            average_time DESC
          LIMIT 100

pgsql-general by date:

Previous
From: Stefan Keller
Date:
Subject: Re: splitting up tables based on read/write frequency of columns
Next
From: Peter Geoghegan
Date:
Subject: Re: Getting truncated queries from pg_stat_statements