Re: most idiomatic way to "update or insert"?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: most idiomatic way to "update or insert"?
Дата
Msg-id 41127EF1.70507@archonet.com
обсуждение исходный текст
Ответ на Re: most idiomatic way to "update or insert"?  (Ron St-Pierre <rstpierre@syscor.com>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: most idiomatic way to "update or insert"?
Следующее
От: Geoff Caplan
Дата:
Сообщение: Re: Correct escaping of untrusted data