Re: Better index stategy for many fields with few values

Поиск
Список
Период
Сортировка
От PFC
Тема Re: Better index stategy for many fields with few values
Дата
Msg-id op.s7sypzhpcigqcu@apollo13
обсуждение исходный текст
Ответ на Better index stategy for many fields with few values  (Oscar Picasso <oscgoogle@yahoo.com>)
Список pgsql-performance
> - My items table:
> code int              -- can take one of 100 values
> property varchar(250) -- can take one of 5000 values
> param01 char(10)      -- can take one of 10 values
> param02 char(10)      -- can take one of 10 values
> ...
> [ 20 similar columns }
> ...
> parama20 char(10)     -- can take one of 10 values

    Instead of 20 columns, you could instead use a "param" field containing
an array of 20 TEXT fields.
    Then create a simple index on (code, param) and SELECT WHERE code BETWEEN
... AND param = '{P,G,....,C}'

    If you don't want to modify your structure, you can create a functional
index on an array {param1...param20}, but your queries will be a bit
uglier.

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

Предыдущее
От: PFC
Дата:
Сообщение: Re: Restore performance?
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Takes too long to fetch the data from database