Re: low cardinality column - Mailing list pgsql-performance

From Rod Taylor
Subject Re: low cardinality column
Date
Msg-id 1065120643.89807.40.camel@jester
Whole thread Raw
In response to low cardinality column  ("Rong Wu" <rwu@cbnco.com>)
Responses Re: low cardinality column
List 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;

Attachment

pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: low cardinality column
Next
From: Bill Moran
Date:
Subject: Re: low cardinality column