Arjen van der Meijden wrote:
>
> I left all the configuration-stuff to the defaults since changing values
> didn't seem to impact much. Apart from the buffers and effective cache,
> increasing those made the performance worse.
I've not looked at the rest of your problem in detail, but using the
default configuration values is certainly not going to help things. In
particular effective_cache is supposed to tell PG how much memory your
OS is using to cache data.
Read this through and make sure your configuration settings are sane,
then it might be worthwhile looking in detail at this particular query.
http://www.powerpostgresql.com/PerfList
--
Richard Huxton
Archonet Ltd