                 'SHOW%'])
         GROUP BY
             queryid
-),
-q_queryid_text AS (
-    SELECT
-        queryid::text,
-        query::varchar(8000)
-    FROM
-        get_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,
+    b.wal_fpi,
+    b.wal_bytes,
+    b.total_plan_time,
+    ltrim(regexp_replace(b.query, E'[ \\t\\n\\r]+', ' ', 'g')) AS tag_query
 FROM (
     SELECT
         *

        round(sum(blk_write_time)::numeric, 3)::double precision AS blk_write_time,
        sum(wal_fpi)::int8 AS wal_fpi,
        sum(wal_bytes)::int8 AS wal_bytes,
        round(sum(s.total_plan_time)::numeric, 3)::double precision AS total_plan_time
    FROM
        get_stat_statements() s
    WHERE

                'SHOW%'])
        GROUP BY
            tag_queryid
)
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
        *
