                 'SHOW%'])
         GROUP BY
             queryid
-),
-q_queryid_text AS (
-    SELECT
-        queryid::text,
-        query::varchar(8000)
-    FROM
-        pg_stat_statements
-    WHERE
-        dbid = (
-            SELECT
-                oid
-            FROM
-                pg_database
-            WHERE
-                datname = current_database()))
-SELECT
-    b.*,
-    (
-        SELECT
-            ltrim(regexp_replace(query, E'[ \\t\\n\\r]+', ' ', 'g'))
-        FROM
-            q_queryid_text
-        WHERE
-            q_queryid_text.queryid = b.tag_queryid
-        LIMIT 1) AS tag_query
+)
+SELECT (EXTRACT(epoch FROM now()) * 1e9)::int8 AS epoch_ns,
+       b.tag_queryid,
+       b.users,
+       b.calls,
+       b.total_time,
+       b.shared_blks_hit,
+       b.shared_blks_read,
+       b.shared_blks_written,
+       b.shared_blks_dirtied,
+       b.temp_blks_read,
+       b.temp_blks_written,
+       b.blk_read_time,
+       b.blk_write_time,
+       ltrim(regexp_replace(b.query, E'[ \\t\\n\\r]+', ' ', 'g')) tag_query
 FROM (
     SELECT
         *

                'SHOW%'])
        GROUP BY
            queryid
),
q_queryid_text AS (
    SELECT
        queryid::text,
        query::varchar(8000)
    FROM
        pg_stat_statements
    WHERE
        dbid = (
            SELECT
                oid
            FROM
                pg_database
            WHERE
                datname = current_database()))
SELECT
    b.*,
    (
        SELECT
            ltrim(regexp_replace(query, E'[ \\t\\n\\r]+', ' ', 'g'))
        FROM
            q_queryid_text
        WHERE
            q_queryid_text.queryid = b.tag_queryid
        LIMIT 1) AS tag_query
FROM (
    SELECT
        *

$sql$
WITH q_data AS (
    SELECT
        (regexp_replace(md5(query::varchar(1000)), E'\\D', '', 'g'))::varchar(10)::text as tag_queryid,
        max(query::varchar(8000)) AS query,
        /*
         NB! if security conscious about exposing query texts replace the below expression with a dash ('-') OR
         use the stat_statements_no_query_text metric instead, created specifically for this use case.
