Re: two memory-consuming postgres processes

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Alexy Khrabrov" <deliverable(at)gmail(dot)com>
Cc: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: two memory-consuming postgres processes
Date: 2008-05-03 15:07:11
Message-ID: b42b73150805030807q23805b00yf122c4490fd0bc82@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, May 2, 2008 at 4:51 PM, Alexy Khrabrov <deliverable(at)gmail(dot)com> wrote:
>
> On May 2, 2008, at 1:40 PM, Scott Marlowe wrote:
>
> > Again, a database protects your data from getting scrambled should the
> > program updating it quit halfway through etc...
> >
>
> Right -- but this is a data mining work, I add a derived column to a row,
> and it's computed from that very row and a small second table which should
> fit in RAM.

Full table update of a single field is one of the worst possible
operations with PostgreSQL. mysql is better at this because lack of
proper transactions and full table locking allow the rows to be
(mostly) updated in place. Ideally, you should be leveraging the
power of PostgreSQL so that you can avoid the full table update if
possible. Maybe if you step back and think about the problem you may
be able to come up with a solution that is more efficient.

Also, if you must do it this way, (as others suggest), do CREATE TABLE
new_table AS SELECT...., then create keys, and drop the old table when
done. This is much faster than update.

merlin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Francisco Reyes 2008-05-04 02:15:11 Re: Vacuum statistics
Previous Message Matthew Wakeling 2008-05-03 09:25:28 Re: two memory-consuming postgres processes