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