pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tobias Brox <tobias@nordicbet.com>
To: Tobias Brox <tobias@nordicbet.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: "nice"/low priority Query
Date: Tue, 2 Aug 2005 21:59:15 +0200
Message-ID: <20050802195915.GA9691@tobias.lan> (raw)
In-Reply-To: <20050802160434.GD9278@tobias.lan>
References: <20050802160434.GD9278@tobias.lan>

[Tobias Brox - Tue at 06:04:34PM +0200]
> (...) and at one
> point in the code I'm even asking the database for "explain plan", grepping
> out the estimated cost number, and referring the user to take contact with
> the IT-dept if he really needs the report.  But I digress.

I just came to think about some more "dirty" tricks I can do.  I have turned
on stats collection in the configuration; now, if I do:

  select count(*) from pg_stat_activity where not current_query like '<IDLE>%';
  
or, eventually:

  select count(*) from pg_stat_activity 
  where not current_query like '<IDLE>%' and query_start+'1 second'<now();

it will give a hint about how busy the database server is, thus I can
eventually let the application sleep and retry if there are any other heavy
queries in progress.

-- 
Tobias Brox, +47-91700050
Nordicbet, IT dept



view thread (7+ messages)  latest in thread

Message-ID: <20050802195915.GA9691@tobias.lan>
Permalink:  ../20050802195915.GA9691@tobias.lan/
Also on:    postgresql.org/message-id/20050802195915.GA9691@tobias.lan

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tobias@nordicbet.com
  Subject: Re: "nice"/low priority Query
  In-Reply-To: <20050802195915.GA9691@tobias.lan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox