Skip site navigation (1) Skip section navigation (2)

Re: Logging just SQL commands in an SQL script format

From: "Campbell, Lance" <lance(at)uiuc(dot)edu>
To: "Rigmor Ukuhe" <rigmor(dot)ukuhe(at)finestmedia(dot)ee>,<pgsql-admin(at)postgresql(dot)org>
Subject: Re: Logging just SQL commands in an SQL script format
Date: 2007-01-25 16:53:52
Message-ID: A3AC4FA47DC0B1458C3E5396E685E63302395C5A@SAB-DC1.sab.uiuc.edu (view raw or flat)
Thread:
Lists: pgsql-admin
I actually wrote a java application that can strip out the SQL and build
a SQL script file.

If you take a snap shot of your database and then log the SQL commands
you have at least a real world snapshot of the SQL being executed for a
given time.  This gives you some level of measurement when comparing
some settings like memory allocation and index changes.  

You are correct it is not perfect.  But it does give you a way to
measure the performance difference to some degree.  Performance tuning a
database is considered an art by many because every database is
different and every server is different.  I am just trying to take a
little of the art out of the equation.

Thanks,

Lance Campbell
Project Manager/Software Architect
Web Services at Public Affairs
University of Illinois
217.333.0382
http://webservices.uiuc.edu
 

-----Original Message-----
From: pgsql-admin-owner(at)postgresql(dot)org
[mailto:pgsql-admin-owner(at)postgresql(dot)org] On Behalf Of Rigmor Ukuhe
Sent: Thursday, January 25, 2007 7:21 AM
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] Logging just SQL commands in an SQL script format

Campbell, Lance wrote:
> 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;
> 
>  

Hi,

Wouldn't SQL statements in log possible be out of order, also
transaction info 
would be missing?

Even if you do it in application-side, logging query start time and
transaction 
info, and feed this data to some application that starts to excecute
them in 
correct time and context, you wouldnt be able to reliably replicate
exact 
behavior, cause configuration change might change query times too much.
But i see it _can_ be useful in some cases.

Rigmor

> 
>  
> 
> 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
> 
>  
> 
> !DSPAM:5,45b7c785287772091230466!


-- 
Rigmor Ukuhe
Finestmedia Ltd | Software Development Team Manager
gsm : (+372)56467729 | tel : (+372)6558043 | e-mail :
rigmor(dot)ukuhe(at)finestmedia(dot)ee

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
       message can get through to the mailing list cleanly

In response to

pgsql-admin by date

Next:From: Bruno Wolff IIIDate: 2007-01-25 17:45:58
Subject: Re: Case-sensitive
Previous:From: Bruce MomjianDate: 2007-01-25 15:09:49
Subject: Re: Case-sensitive

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group