Re: auto-filling a field on insert

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: auto-filling a field on insert
Дата
Msg-id dcc563d10910232343j6ee661afu4e50888a7cfcdfcf@mail.gmail.com
обсуждение исходный текст
Ответ на Re: auto-filling a field on insert  (semi-ambivalent <thefronny@gmail.com>)
Ответы Re: auto-filling a field on insert  (Craig Ringer <craig@postnewspapers.com.au>)
Список pgsql-general
On Fri, Oct 23, 2009 at 9:32 PM, semi-ambivalent <thefronny@gmail.com> wrote:
> On Oct 23, 5:10 am, cr...@postnewspapers.com.au (Craig Ringer) wrote:
>> semi-ambivalent wrote:
>> > At first blush that looks good but I need an index on that concatted
>> > value and I don't seem to be able to index a field in a view. I'll
>> > check the docs on views to see if I'm missing something.
>>
>> As others have noted, a multi-field index or a functional index is
>> probably the best option.
>>
>> If you decide for some reason that you really, really need the
>> concatenated fields stored in the table its self, you will need to use a
>> BEFORE INSERT ... FOR EACH ROW trigger to populate field `D'.
>>
>> --
>> Craig Ringer
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-gene...@postgresql.org)
>> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general
>
> Thanks everyone for the pointers. I like the idea of getting rid of
> the concatenated field even though it reduced the worst case query
> time to one tenth of what I had been seeing. But for now I'm going to
> keep it there because I'm ignorant about triggers so this will be a
> good opportunity to learn about them before I drop the column for
> something more efficient, assuming there is.

The multi column index should give you equivalent speed.

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

Предыдущее
От: semi-ambivalent
Дата:
Сообщение: Re: auto-filling a field on insert
Следующее
От: Johan Nel
Дата:
Сообщение: Re: Research and EAV models