From: | Dinesh Kumar <dinesh(dot)kumar(at)enterprisedb(dot)com> |
---|---|
To: | Peter Kroon <plakroon(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: pgadmin III query |
Date: | 2013-12-09 13:46:09 |
Message-ID: | CAKWsr7iMKhN+yFc6d37JtSJ-w5YO_tdhGX786fYgL-y7uWUewQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Peter,
On Mon, Dec 9, 2013 at 7:03 PM, Peter Kroon <plakroon(at)gmail(dot)com> wrote:
> Hi Dinesh,
>
>
> >Get all the queries what it has performed.
>
> How and where?
> When I run "select * from pg_stat_activity" I get the same result with and
> without "log_minduration_statement=0"
>
>
By setting this parameter log_min_duration_statement to 0, postgres will
log all the queries, in the pg_log file.
Hope the following steps helps you on this, and make sure you have enabled
the logging_collector.
1. Modify the above parameter on the required postgres cluster.
2. Do SELECT pg_reload_conf(); on the same machine.
3. And go to pg_log file location, and do tail -f current pg_log file.
4. Go to pgadmin, and refresh on any table.
5. Check the tail -f <pg_log>file output. There you will find all the sql
queries, which have been executed from pgAdmin.
6. Collect those queries, and make your own custom function with pl/pgsql
language.
Regards,
Dinesh
> Could you provide a more detailed step by step guide?
>
> Best,
> Peter
>
>
>
> 2013/12/9 Dinesh Kumar <dinesh(dot)kumar(at)enterprisedb(dot)com>
>
>> Hi,
>>
>> On Fri, Dec 6, 2013 at 4:34 PM, Peter Kroon <plakroon(at)gmail(dot)com> wrote:
>>
>>> Thanks, but i need a non command line option.
>>>
>>>
>> We can do this with a function which is having the sql queries of pgAdmin
>> raised against the database.
>>
>> => Log all the queries by enabling "log_minduration_statement=0".
>> => Do SELECT pg_reload_conf();
>> => Do a refresh on a table of pgAdmin's browser.
>> => Get all the queries what it has performed.
>> => Create a custom function with those queries.
>>
>> Regards,
>> Dinesh
>>
>>
>>>
>>> 2013/12/6 Ian Lawrence Barwick <barwick(at)gmail(dot)com>
>>>
>>>> 2013/12/6 Peter Kroon <plakroon(at)gmail(dot)com>:
>>>> > When you click on a table in the "Object browser" you'll see in the
>>>> "SQL
>>>> > pane" the sql that is needed to create that table.
>>>> >
>>>> > Which function can I call to get that SQL?
>>>>
>>>> You can use the pg_dump command line function for this:
>>>>
>>>> pg_dump -s -t name_of_table name_of_database
>>>>
>>>> Regards
>>>>
>>>> Ian Barwick
>>>>
>>>
>>>
>>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2013-12-09 14:09:12 | Re: client that supports editing views |
Previous Message | Willy-Bas Loos | 2013-12-09 13:36:26 | client that supports editing views |