How do I tell?

Поиск
Список
Период
Сортировка
Искать

How do I tell?

От:
ken.corey@atomic-interactive.com
Дата:
Hi All,

I'm currently running postgres 7.1b3 (Yes, I know it's an older version), 
and I'm seeing some strange behavior. 

I've got a web browser and a jserv engine that start up 40 connections to 
the database when they are started.  When load on the database machine gets 
high, I'll have 1 or 2 processes that won't ever end.  They'll just 
continue, soaking up CPU until I kill the database server. 

My question isn't so much about the behavior itself (I'm presuming I've done 
something bone-headed), but about the debugging of the behavior. 

Is there any way in which I can see exactly the query that a postgres 
process is processing?  I know that with 'ps -auxww' I can see the state of 
a given postgres process (idle/SELECT/SELECT waiting)...but how do I find 
out that that SELECT really is:
"SELECT * from everything joined with everything else and a couple of outer 
joins, order by, group by and limit" 

 --
Ken Corey    CTO    http://www.atomic-interactive.com 

Re: How do I tell?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
ken.corey@atomic-interactive.com writes:
> I'm currently running postgres 7.1b3 (Yes, I know it's an older version), 
> and I'm seeing some strange behavior. 

There are quite a few known bugs in 7.1b3.  You really should update to
the release version before you get bitten, rather than after...

> Is there any way in which I can see exactly the query that a postgres 
> process is processing?

Attach to it with gdb and do "p debug_query_string" (you need 7.1.1
for this to work).  Alternatively, enable query logging (-d2 to
postmaster or appropriate thing in postgresql.conf), and look in the
log to see what query it accepted last.

			regards, tom lane
FAQ