From: | Pawel Veselov <pawel(dot)veselov(at)gmail(dot)com> |
---|---|
To: | Igor Neyman <ineyman(at)perceptron(dot)com> |
Cc: | Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Help with slow table update |
Date: | 2015-04-15 18:19:11 |
Message-ID: | CAMnJ+BdPtxBP9ChgvU+GSV0EV-zAMEQhjO3k3kr8YFWi5Cdsqg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>
> [skipped]
>
>
>
> This is where using sets becomes really tedious, as Postgres severely
> lacks an upsert-like statement.
>
> I don't think there are joins allowed in UPDATE statement, so I will need
> to use WITH query, right?
>
> Also, I'm not sure how LEFT JOIN will help me isolate and insert "missed"
> entries...
>
>
>
> [skipped]
>
>
>
> Yes, you can do UPDATE with joins (
> http://www.postgresql.org/docs/9.4/static/sql-update.html) like this:
>
>
>
> UPDATE table1 A SET col1 = B.col2
>
> FROM table2 B
>
> WHERE A.col3 = B.col4;
>
I meant using JOIN operator in the update. But it's still possible, though
through WITH query.
From | Date | Subject | |
---|---|---|---|
Next Message | Filip Lyncker | 2015-04-15 19:03:19 | Best way to migrate a 200 GB database from PG 2.7 to 3.6 |
Previous Message | Andreas Joseph Krogh | 2015-04-15 14:22:16 | Re: How to keep pg_largeobject from growing endlessly |