Re: Better index stategy for many fields with few values - Mailing list pgsql-performance

From PFC
Subject Re: Better index stategy for many fields with few values
Date
Msg-id op.s7sypzhpcigqcu@apollo13
Whole thread Raw
In response to Better index stategy for many fields with few values  (Oscar Picasso <oscgoogle@yahoo.com>)
List 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 by date:

Previous
From: PFC
Date:
Subject: Re: Restore performance?
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Takes too long to fetch the data from database