> From: pgsql-performance-owner@postgresql.org
[mailto:pgsql-performance-
> owner@postgresql.org] On Behalf Of Robin Houston
> Sent: Thursday, July 09, 2009 12:35 PM
> We have a query that runs very slowly on our 8.3 database. (I can't
> tell you exactly how slowly, because it has never successfully run to
> completion even when we left it running overnight.) On the 8.4
> database on my laptop, it runs in about 90 seconds.
> Any insights would be much appreciated.
I doubt this is the insight you're looking for, but that is the worst
query I have ever seen. It is difficult to understand exactly what it
returns. There are so many cross joins, outer joins, and inner joins
mixed up together, ugh.
Rather than trying to puzzle out why it is slow, rewrite it. It will be
faster than before on any version.
Matthew Hartman
Programmer/Analyst
Information Management, ICP
Kingston General Hospital