Re: "nice"/low priority Query

From: Tobias Brox
Subject: Re: "nice"/low priority Query
Date: ,
Msg-id: 20050802195915.GA9691@tobias.lan
(view: Whole thread, Raw)
In response to: "nice"/low priority Query  (Tobias Brox)
Responses: Re: "nice"/low priority Query  (Richard Huxton)
List: pgsql-performance

Tree view

"nice"/low priority Query  (Tobias Brox, )
 Re: "nice"/low priority Query  (Tom Lane, )
  Re: "nice"/low priority Query  (Richard Huxton, )
  Re: "nice"/low priority Query  ("Jim C. Nasby", )
   Re: "nice"/low priority Query  (Neil Conway, )
 Re: "nice"/low priority Query  (Tobias Brox, )
  Re: "nice"/low priority Query  (Richard Huxton, )

[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


pgsql-performance by date:

From: Tobias Brox
Date:
Subject: Re: "nice"/low priority Query
From: Richard Huxton
Date:
Subject: Re: "nice"/low priority Query