From: | "David F(dot) Skoll" <dfs(at)roaringpenguin(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | What kind of index to use for many rows with few unique values? |
Date: | 2002-12-02 22:10:00 |
Message-ID: | Pine.LNX.4.50.0212021707290.6178-100000@shishi.roaringpenguin.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi,
I have a table with a column called "state". Each row can be in one
of four states, let's call them 'new', 'pending', 'ok', and 'bad'.
On average, about 95% of the rows will be 'bad', with the remaining
5% being in one of the other three states. If the table has 50K rows
and I just want to pull out the 'ok' rows, I don't want to do a sequential
scan. To pull out the 'bad' rows, obviously, sequential scan is fine.
I've heard that a btree index performs badly in this situation. Is
a hash index appropriate? I've heard bad things about hash indexes in
PostgreSQL.
Regards,
David.
Roaring Penguin Software Inc. | http://www.roaringpenguin.com
GPG fingerprint: C523 771C 3710 0F54 B2D2 4B0D C6EF 6991 34AB 95BA
GPG public key: http://www.roaringpenguin.com/dskoll-key-2002.txt ID: 34AB95BA
From | Date | Subject | |
---|---|---|---|
Next Message | Joel Burton | 2002-12-02 23:04:38 | Re: What kind of index to use for many rows with few unique values? |
Previous Message | Stephan Szabo | 2002-12-02 21:27:36 | Re: [SQL] CURRENT_TIMSTAMP |