Re: tune postgres for UPDATE

From: Filip Rembiałkowski <filip(dot)rembialkowski(at)gmail(dot)com>
To: Sebastian Böhm <seb(at)exse(dot)net>
Cc: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: tune postgres for UPDATE
Date: 2008-12-08 14:09:59
Message-ID: 92869e660812080609s193fb253oc2ec28ffc0ed9022@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2008/12/8 Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>

> try rewriting it to something like:
>
> update users set price = p.price from prices p where p.type =
> 'normal_price' and p.currency = users.currency;

also avoid "fake" updates:

update users set price = p.price from prices p where p.type =
'normal_price' and p.currency = users.currency
and users.price is distinct from p.price;

If price change is a frequent operation, rethink the design
- maybe you could keep a pointer to "pricing group" instead of keeping
separate price for every user.

--
Filip Rembiałkowski

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-12-08 15:47:38 Re: tune postgres for UPDATE
Previous Message Liraz Siri 2008-12-08 14:06:08 TurnKey PostgreSQL: new installable live CD optimized for easy of use