Re: Derived columns / denormalization

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Derived columns / denormalization
Дата
Msg-id 27584.1232078795@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Derived columns / denormalization  ("Jamie Tufnell" <diesql@googlemail.com>)
Ответы Re: Derived columns / denormalization  (Erik Jones <ejones@engineyard.com>)
Список pgsql-sql
"Jamie Tufnell" <diesql@googlemail.com> writes:
>  item_count int -- this is derived from (select count(*) from items
> where group_id = id)
>  ...

> item_count would be updated by insert/update/delete triggers on the
> items table, hopefully that would ensure it is always correct?

> I'm wondering is what I'm trying to do here pretty standard and are
> there any gotchas I should be aware of?

Concurrent updates to the items table make this much harder than
it might first appear.  If you're willing to serialize all your updating
transactions then you can make it work, but ...
        regards, tom lane


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

Предыдущее
От: "Jamie Tufnell"
Дата:
Сообщение: Derived columns / denormalization
Следующее
От: Erik Jones
Дата:
Сообщение: Re: Derived columns / denormalization