Re: Fwd: Tricky join and update with same table

From: Luca Ferrari <fluca1978(at)infinito(dot)it>
To: James David Smith <james(dot)david(dot)smith(at)gmail(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Fwd: Tricky join and update with same table
Date: 2013-07-26 16:05:28
Message-ID: CAKoxK+6RgG22mh2z0=5NHSdii8hL06HQ4=RWpdGErvPCzJT8-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Jul 26, 2013 at 4:36 PM, James David Smith
<james(dot)david(dot)smith(at)gmail(dot)com> wrote:
> Luca sent me an email a short while ago with some code to try however, and
> I'm doing that at the moment. Though it's been running for about 30 minutes
> now and isn't done. Though there are 230,000 rows, so perhaps that isn't
> that surprising after all. Here it is for posterity:
>

Ops...I was supposed to hit the "reply all" button!
Supposing it is working for you, you can at least split the update
into chunks insering a condition on the main query to update only rows
within a certain date range (let's say the most recent ones). That
will tell you if the query is working properly.
That is als the reason why I suggested using a trigger for further
inserts: I was suppsoing you had a lot of data and therefore doing an
update of chunks when the data is inserted does not make you have to
run a very long query.

Luca

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Francisco Leovey 2013-07-26 18:21:44 Using wildcard for table name ?
Previous Message Michael Swierczek 2013-07-26 14:53:17 Re: Fwd: Tricky join and update with same table