low cardinality column

From: "Rong Wu" <rwu(at)cbnco(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: low cardinality column
Date: 2003-10-02 18:30:01
Message-ID: 33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

I have a select like this:

SELECT MAX(transactionid) FROM cbntransaction WHERE transactiontypeid=0;

in the query:
transactionid is the primary key of cbntransaction table,
But transactiontypeid is a low cardinality column, there're over 100,000
records has the same trnsactiontypeid.
I was trying to create an index on (transactiontypeid, transactionid), but
no luck on that, postgresql will still scan the table.
I'm wondering if there's solution for this query:
Maybe something like if I can partition the table using transactiontypeid,
and do a local index on transactionid on each partition, but I couldnt'
find any doc on postgresql to do that.

Thanks in advance,
rong :-)

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2003-10-02 18:37:22 Re: low cardinality column
Previous Message rwu.cbnco.com 2003-10-02 17:03:13 low cardinality column