473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Stuck processes, viewing the queries inside

We have a running server (v7.3) which, over time, seems to accumulate a
bunch of "stuck" PostgreSQL instances which appear to be dead inside of
a transaction. For example, "ps" reveals many of these:
postgres 17683 0.0 0.4 7376 1032 ? S Nov13 0:21 postgres:
bryan sourceid 127.0.0.1 idle in transaction

As admin, I'd like to run "psql" and peer inside the system (using the
Statistics Collector) to see which queries have been run inside some of
these stuck transactions. It will help me debug what's going wrong.

This page:

http://www.postgresql.org/docs/7.3/s...ing-stats.html

gives lots of intereseting methods for pulling information on the
running state, but I can't see a query for "given a process ID currently
in a transaction, show me all the queries which have been run in it so
far".

Any pointers would be appreciated,

Bryan

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #1
2 2959
Bryan Field-Elliot <br*********@netmeme.org> writes:
We have a running server (v7.3) which, over time, seems to accumulate a
bunch of "stuck" PostgreSQL instances which appear to be dead inside of
a transaction. For example, "ps" reveals many of these: postgres 17683 0.0 0.4 7376 1032 ? S Nov13 0:21 postgres:
bryan sourceid 127.0.0.1 idle in transaction
"idle in transaction" means the backend is waiting for its connected
client to issue another command. I don't think it's Postgres that you
need to be investigating ...
I can't see a query for "given a process ID currently
in a transaction, show me all the queries which have been run in it so
far".


There is no such query, but you could try turning on query logging and
then studying the postmaster log.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #2
Bryan Field-Elliot <br*********@netmeme.org> writes:
We have a running server (v7.3) which, over time, seems to accumulate a
bunch of "stuck" PostgreSQL instances which appear to be dead inside of
a transaction. For example, "ps" reveals many of these: postgres 17683 0.0 0.4 7376 1032 ? S Nov13 0:21 postgres:
bryan sourceid 127.0.0.1 idle in transaction
"idle in transaction" means the backend is waiting for its connected
client to issue another command. I don't think it's Postgres that you
need to be investigating ...
I can't see a query for "given a process ID currently
in a transaction, show me all the queries which have been run in it so
far".


There is no such query, but you could try turning on query logging and
then studying the postmaster log.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bruce Sandell | last post by:
I have a c# application where I run a query every 10 seconds. After the query completes, I close the connection object, close the oledbdatareader object and dispose of the command object. ...
4
by: pierre.bru | last post by:
hi, fist the context: I have a web server which query a mySql database. but as the number of parralel queries increase, the server slows down too much. I got 2 ideas, one of which is to run N...
9
by: Abhishek Srivastava | last post by:
Hello All, In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated...
5
by: Jeremy | last post by:
I have a core VB service that monitors a database, and based on data in the records will execute code to send email notifications. Problem: I don't want my main program code to halt and wait for...
2
by: Együd Csaba | last post by:
Hi All, I'm wonder if there is any possibility to kick out automatically stuck in queries after say 10 minutes or so? I mean some kind of queries which calls eg. buggy functions with dead loops...
3
by: adsheehan | last post by:
I have been reading many of the posting on the GIL and impact on threading etc. I have found is confusing and would welcome some clarity on this. I understand that embedding the interpreter in a...
5
by: Dylan Parry | last post by:
Hi, I am trying to debug some queries that are being generated by an external program, and I have no way of finding out what the actual syntax of the query is from within the program itself....
5
by: Sune | last post by:
Hi all, I want to make data stored in-memory (not disk) available to several processes. My concern is that poorly written C applications with dangling pointers may(will) damage the data in this...
3
by: Tom | last post by:
I have a PHP 4.4.7, MySql 5.0 and I.E. 7. My PHP queries the database and renders the info into html forms. Submitting the forms manipulates the data. Now, the problem is that the browsers are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.