From: Stef <svb@ucs.co.za>
To: Postgres SQL List <pgsql-sql@postgresql.org>
Subject: Analyze makes queries slow...
Date: Wed, 6 Aug 2003 17:18:55 +0200
Message-ID: <20030806171855.6c9ebf4d.svb@ucs.co.za> (raw)
Hi all,
I have a problem :
A select statement that selects from 7 tables,
groups the information by 6 columns of the
tables involved.
When there are no rows in pg_statistics,
the query runs under 3 minutes.
When I analyze the biggest table of the 7
(approx 1000000 rows), the query takes longer than
12 Hours (Had to kill it eventually).
I have the explain plan of the original, under 3 minutes
query, and would like to reverse engineer this, to
build up a query with proper join statements, as I understand
that this is a way of forcing the planner to join the table
in a faster way.
I got very close a couple of times, but still can't get it 100%
the same as what the planner did prior to analyzing.
The database is actually faster when analyzed, except
for two or three multiple join queries (which don't finish
after analyze) So I would like to make an exception
for the tables that are used in these queries only,
or do proper joins.
Can anybody help, or give some links to good
help resources?
TIA
Stefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: svb@ucs.co.za
Subject: Re: Analyze makes queries slow...
In-Reply-To: <20030806171855.6c9ebf4d.svb@ucs.co.za>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox