Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2014

    Unanswered: Discover which command was sent to postgreSQL

    Hi guys!

    I'm new here, so forgive me if I'm asking an old question.
    I'm developing a new app but I need to use the same database that the current app uses. So I need to map the queries the old app do. Like this: if I click on "search products" I need to discover how this query was sent to the database, like "SELECT...". Is there a command i can use in postgresql to do that?

    Thanks in advance.

  2. #2
    Join Date
    Aug 2014
    I too am new, and also interested in this same question.
    Is there an easy way to send ALL PostgreSQL queries to logs ?
    Last edited by bluegroper; 08-10-14 at 18:34.

  3. #3
    Join Date
    Jun 2004
    Arizona, USA
    If you have access to the database config files, you can configure your server to log many different things, including SQL statements.

    in postgresql.conf, look at the log_statement setting. The possible choices are none (default,) ddl, mod (dml,) and all. You'll have to reload the configuration file after changing it.

    If there are a lot of people 'hitting' the database concurrently though, your log files can get quite large.
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert

  4. #4
    Join Date
    Nov 2003
    Provided Answers: 23
    The extension pg_stat_statements is probably helpful as well:
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags:

    Tips for good questions:

  5. #5
    Join Date
    Aug 2014
    Thank you all!

    It worked for me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts