Performance weirdness with/without vacuum analyze

From: Harry Broomhall <harry(dot)broomhall(at)uk(dot)easynet(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: Performance weirdness with/without vacuum analyze
Date: 2003-10-20 16:50:16
Message-ID: 200310201650.RAA12431@haeb.noc.uk.easynet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

It has been suggested to me that I resubmit this question to this list,
rather than the GENERAL list it was originaly sent to.

I asked earlier about ways of doing an UPDATE involving a left outer
join and got some very useful feedback.

This has thrown up a (to me) strange anomaly about the speed of such
an update.

The input to this query is a fairly large (the example I'm working
with has 335,000 rows) set of records containing numbers to be looked
up in the lookup table. This lookup table has 239 rows.

I'm always reading the suggestion that doing a 'VACUUM ANALYZE' on a
database is 'A Good Thing' as it helps the planner to do the best thing, so
I arranged a vacuum analyze on the input records.

Running the query takes about 13 mins or so.

If, however I *don't* do an analyze, but leave the input table as
it was when imported the run takes about 2.5 mins!

Looking at the output from 'explain' I can see that the main difference
in the way the planner does it is that it does a merge join in the non-analyze
case, and a hash join in the analyze case.

Unfortunately I don't really know what this is implying, hence the call
for assistance.

I have a file with all sorts of info about the problem (details of tables,
output of 'explain' etc) but as it is about 5K in size, and wide as well, I
didn't want to dump it in the list without any warning!

However - it has been suggested that it should be OK to include this I have
now done so - hopefully with this message.

Regards,
Harry.

Attachment Content-Type Size
run.info.txt text/plain 5.0 KB

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2003-10-20 17:07:48 Re: [PERFORM] Low Insert/Update Performance
Previous Message Seum-Lim Gan 2003-10-20 16:04:43 Re: index file bloating still in 7.4 ?