From: PFC <lists@peufeu.com>
To: Oscar Picasso <oscgoogle@yahoo.com>
To: pgsql-performance@postgresql.org
Subject: Re: Better index stategy for many fields with few values
Date: Mon, 10 Apr 2006 19:26:13 +0200
Message-ID: <op.s7sypzhpcigqcu@apollo13> (raw)
In-Reply-To: <20060410165857.91471.qmail@web54705.mail.yahoo.com>
References: <20060410165857.91471.qmail@web54705.mail.yahoo.com>
> - 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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: lists@peufeu.com, oscgoogle@yahoo.com
Subject: Re: Better index stategy for many fields with few values
In-Reply-To: <op.s7sypzhpcigqcu@apollo13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox