Comparitive UPDATE speed

Josh Berkus <josh@agliodbs.com>

From: Josh Berkus <josh@agliodbs.com>
To: <pgsql-performance@postgresql.org>
Date: 2002-10-01T21:51:29Z
Lists: pgsql-performance
Relative performance question:

I have 2 UPDATE queires in a function. 

table_a:  117,000 records
table_b: 117,000 records
table_c: 1.5 million records

 #1 updates table_a, field_2 from table_b, field_1 based on a joining field_3. 
Around 110,000 updates
#2 updates table_a, field_5 from table_c, field_2 joining on field_3.  
Around 110,000 updates.

#1 takes 5-7 minutes; #2 takes about 15 seconds.  The only difference I can 
discern is that table_a, field_2 is indexed and table_a, field_5 is not.

Is it reasonable that updating the index would actually make the query take 
20x longer?  If not, I'll post actual table defs and query statements.

-- 
Josh Berkus
josh@agliodbs.com
Aglio Database Solutions
San Francisco