Re: update functions locking tables - Mailing list pgsql-general

From Jim C. Nasby
Subject Re: update functions locking tables
Date
Msg-id 20050830234704.GF77007@pervasive.com
Whole thread Raw
In response to Re: update functions locking tables  (Clodoaldo Pinto <clodoaldo.pinto@gmail.com>)
Responses Re: update functions locking tables  (Clodoaldo Pinto <clodoaldo.pinto@gmail.com>)
List pgsql-general
On Tue, Aug 30, 2005 at 08:13:15AM -0300, Clodoaldo Pinto wrote:
> 2005/8/29, Michael Fuhr <mike@fuhr.org>:
> >
> > In general, writers shouldn't block readers.  Have you examined
> > pg_locks?  Do you know exactly what the blocked queries are, or can
> > you find out from pg_stat_activity (stats_command_string must be
> > enabled)?  Are you doing any explicit locking (LOCK statement)?
> >
>
> This is one of the blocked queries:
> select count (*) from times_producao where pontos_0 - pontos_7 > 0;

FWIW, that where clause might be more efficient as
WHERE pontos_0 > pontos_7. Some databases would be able to use indexes
to answer that (not sure if PostgreSQL could), plus it removes an
operator. It also seems to be cleaner code to me. :)
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software        http://pervasive.com        512-569-9461

pgsql-general by date:

Previous
From: Guy Doune
Date:
Subject: Get postgresql workin in french...
Next
From: Clodoaldo Pinto
Date:
Subject: Re: update functions locking tables