Logging just SQL commands in an SQL script format

Поиск
Список
Период
Сортировка
От Campbell, Lance
Тема Logging just SQL commands in an SQL script format
Дата
Msg-id A3AC4FA47DC0B1458C3E5396E685E63302395C55@SAB-DC1.sab.uiuc.edu
обсуждение исходный текст
Ответы Re: Logging just SQL commands in an SQL script format  (Rigmor Ukuhe <rigmor.ukuhe@finestmedia.ee>)
Re: Logging just SQL commands in an SQL script format  ("Daniel Cristian Cruz" <danielcristian@gmail.com>)
Список pgsql-admin

I want to log all SQL commands as an executable script file for use in performance testing.  Currently there is a lot of information in the log that is generated that would not be executable.  Below is an example of what I would want to see; which is just the SQL.

 

Example of log output:

Select a,b,c from calendar where a=12;

Select a,b,c from calendar where a=13;

 

Example:

1) I would take a snap shot of our production database. 

2) I would then turn on SQL logging. 

3) I would put the copy of the database onto a test server. 

4) After a few days of logging the SQL commands I would copy the file to the test server.

5) I would then have a basic script that would display the start time, execute the postgres SQL log (pgsql –d database_name –f sql_log_file_name), and then display the end time.

 

Now I can test configuration changes and index modifications on real world data to see what impact the changes would have.  I just keep reloading the database, change the configurations settings, and then execute the script again.

 

The key is that the SQL log be in a format that can be executed as a postgres SQL file.

 

How do I do this?

 

Thanks,

 

 

 

Lance Campbell

Project Manager/Software Architect

Web Services at Public Affairs

University of Illinois

217.333.0382

http://webservices.uiuc.edu

 

В списке pgsql-admin по дате отправления:

Предыдущее
От: Colton A Smith
Дата:
Сообщение: an atypical pg_restore?
Следующее
От: Ryan Underwood
Дата:
Сообщение: kerberos 5: wrong principal