非互換
pg_stat_statementsにおいて、DECLARE、EXPLAIN、CREATE MATERIALIZED VIEW、CREATE TABLE ASのコマンドのクエリ文字列の定数部分を正規化し、$1などのように表示するようにします。
postgres=# EXPLAIN (costs off) SELECT a FROM generate_series(1,10) AS tab(a) WHERE a = 7; QUERY PLAN -------------------------------------- Function Scan on generate_series tab Filter: (a = 7) (2 rows) postgres=# SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C"; calls | rows | query -------+------+------------------------------------------------------------------------------- 1 | 0 | EXPLAIN (costs off) SELECT a FROM generate_series(1,10) AS tab(a) WHERE a = 7 1 | 1 | SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C" (2 rows)
postgres=# EXPLAIN (costs off) SELECT a FROM generate_series(1,10) AS tab(a) WHERE a = 7; QUERY PLAN -------------------------------------- Function Scan on generate_series tab Filter: (a = 7) (2 rows) postgres=# SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C"; calls | rows | query -------+------+--------------------------------------------------------------------------------- 1 | 0 | EXPLAIN (costs off) SELECT a FROM generate_series($1,$2) AS tab(a) WHERE a = $3 1 | 0 | SELECT calls, rows, query FROM pg_stat_statements ORDER BY query COLLATE "C" (2 rows)
対処方法
ありません。