Re: UPDATE with JOIN not using index

From: Arnaud Lesauvage <arnaud(dot)listes(at)codata(dot)eu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Richard Huxton <dev(at)archonet(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: UPDATE with JOIN not using index
Date: 2010-03-16 15:08:51
Message-ID: 4B9F9F03.2020807@codata.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le 16/03/2010 15:37, Tom Lane a écrit :
> Arnaud Lesauvage<arnaud(dot)listes(at)codata(dot)eu> writes:
>> First query :
>> "Merge Join (cost=699826.38..704333.80 rows=13548 width=836)"
>> " Merge Cond: (((c.rue)::text = (r.rue)::text) AND ((c.codesite)::text
>> = (r.codesite)::text))"
>
>> Second query :
>> "Seq Scan on cellules c (cost=0.00..5018080.39 rows=552343 width=823)"
>
> Please notice that the planner thinks the second plan is much more
> expensive than the first. I think you will find that it's right.
> Using an index is not always the best way to do a query.

Yes indeed, I should have read the output of explain more thoroughly I
guess !
I am still a bit intrigued by the different query plans. Both query look
very similar to me, so why does the planner make so different choices ?

Regards,
Arnaud

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Arnaud Lesauvage 2010-03-16 15:11:05 Re: UPDATE with JOIN not using index
Previous Message tv 2010-03-16 15:02:58 Re: UPDATE with JOIN not using index