0

Halo, first, i say thank you for helping me solve my problem before. I'm really newbie using Postgresql.

now i have new problem, i do select statement like this one :

select * from company where id=10;

when i see the query in pg_stat_statements, i just get the query like this : select * from company where id=?;

from the result the value of id is missing, how i can get the complete query without missing the value??

Thank you :)

  • 1
    You don't. `pg_stat_statements` doesn't record or show bind parameters. You can see it in the logs if you set `log_statement = all` though. – Craig Ringer Nov 02 '16 at 05:09

1 Answers1

1

Alternatively you could set log_min_duration to 0 which will lead Postgres to log every statement.

Pg_stat_statements is meant to be for stats and these are aggregated, if every lookup value would be in there the stats would be useless because it would be hard to group.

If you want to understand a query just run it with explain analyze and you will get the query plan.