David Gagnon wrote: > " -> Index Scan using cr_pk on cr (cost=0.00..6.02 rows=1 > width=828) (actual time=0.073..0.077 rows=1 loops=13587)" > " Index Cond: (((cr.crypnum)::text = 'M'::text) AND > (cr.crnum = "outer".cscrnum))" > " Filter: ((crdate + '00:00:00'::interval) <= > '2005-01-28 00:00:00'::timestamp without time zone)" > " -> Index Scan using rr_pk on rr (cost=0.00..5.99 rows=1 > width=5637) (actual time=0.062..0.069 rows=1 loops=8335)" > " Index Cond: (("outer".crrrnum)::text = (rr.rrnum)::text)" > " -> Index Scan using yr_idx1 on yr (cost=0.00..5.99 rows=1 > width=926) (actual time=0.127..17.379 rows=1154 loops=8335)" Your loops are what is causing the time spent. eg. "actual time=0.127..17.379 rows=1154 loops=8335)" == 8335*(17.379-0.127)/1000=>143 secs (if my math is correct). -- _______________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. _______________________________