Re: low cardinality column

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: rwu(at)cbnco(dot)com
Cc: Postgresql Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: low cardinality column
Date: 2003-10-02 18:50:44
Message-ID: 1065120643.89807.40.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, 2003-10-02 at 14:30, Rong Wu wrote:
> Hi,
>
> I have a select like this:
>
> SELECT MAX(transactionid) FROM cbntransaction WHERE transactiontypeid=0;

For various reasons (primarily MVCC and the ability to make custom
aggregates making it difficult) MAX() is not optimized in this fashion.

Try:

SELECT transactionid
FROM ...
WHERE ...
ORDER BY transactionid DESC
LIMIT 1;

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Bill Moran 2003-10-02 19:00:19 Re: low cardinality column
Previous Message Josh Berkus 2003-10-02 18:37:22 Re: low cardinality column