私はPostgreSQLの初心者です。 これを見つけるのを手伝ってください。PostgreSQLで実行されたクエリの詳細を取得
私はその後、私は単純なクエリを行うテーブル
company (
id bigint primary key,
name text,
age integer,
address character(50),
salary real,
gender character(1))
を持っている:
select * from company where address='texas' and salary=10000
select * from company where address='texas' and salary=15000
select * from company where address='houston' and salary=10000
select * from company where address='texas' and salary=85000
select * from company where address='norway' and salary=100
どのように私は、実行されたクエリの詳細を取得することができ、例えば、クエリ、入力WHERE
の変数と総実行を時間。だから、実行された各クエリを比較して、どのタイプの入力が長時間実行されているかを知ることができます。私はあなたが正しいクエリ実行プランと実行の詳細、探しているように聞こえる質問を読んで
をそれはセットアップにそれほど簡単ではありませんが、[pg_stat_statementsビュー](https://www.postgresql.org/docs/current/static/pgstatstatements.html)モジュールを見てください。 – Abelisto
@Abelistoありがとう、私はそれを行うためにpg_stat_statementを使用しましたが、私のメンターはそのモジュールなしで言った。多分別の方法がありますか? ありがとうございました –
[エラー報告とロギング](https://www.postgresql.org/docs/current/static/runtime-config-logging.html)を使用してみます。パラメータ 'log_statement'を見てください'log_duration'(完了した各SQL文の継続時間を記録する)、' log_min_duration_statement'(文を記録する最小実行時間を設定する)などがあります。 – Abelisto