Performance on update from join

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Performance on update from join
Date: 2002-05-08 16:15:56
Message-ID: 3CD94F3C.4B116582@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

Hi all,
Hi Tom,

I was exploring ways to improve the time required to update a large
table from the join of two others as in:
UPDATE a FROM b, c;

I found that whatever index I create, compound or not, PG insist on
performing the cartesian product first.
Now, if "b" and "c" are relatively small, that make sense, but when the
cartesian product of "b" and "c" is and order of magnitude larger than
"a" it makes no sense at all.

Shouldn't the number of rows in "b" and "c" be reduced to the matching
the criterias on "a" first?
If "b" is meant to be a many to one relation to "c", shouldn't "a" be
joined to "b" first?

Is there a way I can force the "a" join "b" first?

I also tried to do it in a PLPGSQL FOR LOOP, but because the script is
processed as a transaction, I do not get much better performance.

It would sure be nice to be able to commit the change on a row per row
basis.

THX

jll

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2002-05-08 16:46:00 Re: db recovery (FATAL 2)
Previous Message Vilson farias 2002-05-08 14:34:12 Re: Performance question related with temporary tables

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-05-08 16:31:46 Re: postgresql 7.1 file descriptor
Previous Message mlw 2002-05-08 16:00:18 Re: postgresql 7.1 file descriptor