X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6DBBFD1CA44 for ; Fri, 25 Jun 2004 17:01:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85127-03 for ; Fri, 25 Jun 2004 20:01:09 +0000 (GMT) Received: from mailman.paccomsys.com (mail.musicreports.com [64.161.179.34]) by svr1.postgresql.org (Postfix) with ESMTP id 83DD4D1CA3C for ; Fri, 25 Jun 2004 17:01:05 -0300 (ADT) Received: from musicreports.com ([192.168.20.69]) by mailman.paccomsys.com (8.12.9-20030917/8.12.9) with ESMTP id i5PJ06CT007164; Fri, 25 Jun 2004 12:00:07 -0700 Message-ID: <40DC83F9.3030801@musicreports.com> Date: Fri, 25 Jun 2004 12:58:49 -0700 From: Roger Ging User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pam@pmg.xs4all.nl Cc: pgsql-performance@postgresql.org Subject: Re: How can one see what queries are running withing a References: <1088192269.6490.3.camel@localhost> In-Reply-To: <1088192269.6490.3.camel@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PacComSys-MailScanner-Information: Please contact the ISP for more information X-PacComSys-MailScanner: Found to be clean X-MailScanner-From: roger@musicreports.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/331 X-Sequence-Number: 7389 P.A.M. van Dam wrote: >Hi! > >I'd like to know if there is a way to see what queries are running >within a certain postgres instance and how much resources (cpu/memory) >etc. they are using. Right now it's impossible to see what is happening >within postgres when it's binaries are using 100% CPU. > >In Sybase there is a command which let's you view what 'processes' are >running within the server and how much cpu (according to Sybase) they >are using. It also provides you with a stored procedure to kill off some >bad behaving queries. How can one do this within postgres? > >Thanks in advance! > >Best regards, > > Pascal > > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster > > select * from pg_stat_activity. If you want to see the command that was run, you will need to turn on stats_command_string = true in postgresql.conf and re-start server. PID shows up, so you can kill bad queries from terminal and see CUP % in top Roger Ging V.P., Information Technology Music Reports, Inc.