Re: UPDATE .. JOIN? - Mailing list pgsql-general

From Rodrigo E. De León Plicet
Subject Re: UPDATE .. JOIN?
Date
Msg-id a55915760801122022k11b4de14w575d38d26aba4ed7@mail.gmail.com
Whole thread Raw
In response to UPDATE .. JOIN?  (Sergei Shelukhin <realgeek@gmail.com>)
Responses Re: UPDATE .. JOIN?  (Sergei Shelukhin <realgeek@gmail.com>)
Re: UPDATE .. JOIN?  (ledwabakg <kgauledwaba7@gmail.com>)
List pgsql-general
On Jan 12, 2008 5:22 PM, Sergei Shelukhin <realgeek@gmail.com> wrote:
> Hi.
>
> I was wondering if I could do something similar to this in Postgres and
> if yes how?
>
> UPDATE table1 SET blah = 1 FROM table1
>     INNER JOIN table2 ON table1.id = table2.t1id

UPDATE table1 t1
SET blah = 1
FROM table2 t2
WHERE t1.id = t2.t1id

> If not, is there any way to make UPDATE ... WHERE id IN (....) use indexes?

It depends. Read the docs:

http://www.postgresql.org/docs/8.2/static/using-explain.html
http://www.postgresql.org/docs/8.2/static/planner-stats.html
http://www.postgresql.org/docs/8.2/static/planner-stats-details.html

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Prepared Statements
Next
From: Sergei Shelukhin
Date:
Subject: Re: UPDATE .. JOIN?