Re: tune postgres for UPDATE - Mailing list pgsql-general

From Filip Rembiałkowski
Subject Re: tune postgres for UPDATE
Date
Msg-id 92869e660812080609s193fb253oc2ec28ffc0ed9022@mail.gmail.com
Whole thread Raw
In response to Re: tune postgres for UPDATE  ("Grzegorz Jaśkiewicz" <gryzman@gmail.com>)
List pgsql-general


2008/12/8 Grzegorz Jaśkiewicz <gryzman@gmail.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

pgsql-general by date:

Previous
From: Liraz Siri
Date:
Subject: TurnKey PostgreSQL: new installable live CD optimized for easy of use
Next
From: "Scott Marlowe"
Date:
Subject: Re: tune postgres for UPDATE