pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rong Wu <rwu@cbnco.com>
To: pgsql-performance@postgresql.org
Subject: low cardinality column
Date: Thu, 2 Oct 2003 14:30:01 -0400 (EDT)
Message-ID: <33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com> (raw)

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 :-)





view thread (5+ messages)  latest in thread

Message-ID: <33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com>
Permalink:  ../33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com/
Also on:    postgresql.org/message-id/33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: rwu@cbnco.com
  Subject: Re: low cardinality column
  In-Reply-To: <33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com>
  References: <33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com>

* 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