| From: | Richard Huxton <dev(at)archonet(dot)com> |
|---|---|
| To: | Ron St-Pierre <rstpierre(at)syscor(dot)com> |
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: most idiomatic way to "update or insert"? |
| Date: | 2004-08-05 18:39:45 |
| Message-ID: | 41127EF1.70507@archonet.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Ron St-Pierre wrote:
> Okay, this simple example really exists, but the simple table also
> includes a date that the stock was last traded, so we have:
> stock symbol, stock exchange, high, low, open, close, volume, date, plus
> a few more fields
[snip more details]
> BTW these updates do take longer than we'd like so I would appreciate
> more input on how this setup could be redesigned.
Well, I'd probably make the primary key (stock_id, trading_date) and
just insert into a log table. From there I'd update into a summary
table, or use a view.
Of course, that might make things slower in your case.
--
Richard Huxton
Archonet Ltd
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Otto Blomqvist | 2004-08-05 18:55:26 | Creating blank records with sequential record numbers |
| Previous Message | Greg Stark | 2004-08-05 18:18:49 | Re: most idiomatic way to "update or insert"? |