Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 9403E9FB1CB for ; Tue, 20 Mar 2007 22:16:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 77720-06 for ; Tue, 20 Mar 2007 22:15:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from 66-226-76-106.dedicated.abac.net (66-226-76-106.dedicated.abac.net [66.226.76.106]) by postgresql.org (Postfix) with ESMTP id 263C19FA6B0 for ; Tue, 20 Mar 2007 22:16:01 -0300 (ADT) Received: (qmail 21874 invoked by uid 2020); 20 Mar 2007 17:16:00 -0800 Received: from wsip-70-167-125-69.sd.sd.cox.net (HELO ?192.168.0.51?) (70.167.125.69) by 192.168.0.4 with (DHE-RSA-AES256-SHA encrypted) SMTP; 20 Mar 2007 17:15:59 -0800 Message-ID: <46008747.30206@modgraph-usa.com> Date: Tue, 20 Mar 2007 17:15:51 -0800 From: "Craig A. James" User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: Dan Harris CC: PostgreSQL Performance Subject: Re: Determining server load from client References: <460080A2.20800@drivefaster.net> In-Reply-To: <460080A2.20800@drivefaster.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.433 tagged_above=0 required=5 tests=AWL, BAYES_05, HELO_DYNAMIC_IPADDR2 X-Spam-Level: ** X-Archive-Number: 200703/292 X-Sequence-Number: 23697 Dan Harris wrote: > I've found that it would be helpful to be able to tell how busy my > dedicated PG server is ... > > I have seen some other nice back-end things exposed through PG functions > ( e.g. database size on disk ) and wondered if there was anything > applicable to this. I'd write a simple pg-perl function to do this. You can access operating-system calls to find out the system's load. But notice that you need "Untrusted Perl" to do this, so you can only do it on a system where you trust every application that connects to your database. Something like this: create or replace function get_stats() returns text as ' open(STAT, "; close STAT; return join("", @stats); ' language plperlu; See http://www.postgresql.org/docs/8.1/interactive/plperl-trusted.html Craig