pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <rbt@rbt.ca>
To: rwu@cbnco.com
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: low cardinality column
Date: Thu, 02 Oct 2003 14:50:44 -0400
Message-ID: <1065120643.89807.40.camel@jester> (raw)
In-Reply-To: <33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com>
References: <33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com>

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;

Attachments:

  signature.asc (application/pgp-signature, 186B) download

view thread (5+ messages)  latest in thread

Message-ID: <1065120643.89807.40.camel@jester>
Permalink:  ../1065120643.89807.40.camel@jester/
Also on:    postgresql.org/message-id/1065120643.89807.40.camel@jester

 · 

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: rbt@rbt.ca, rwu@cbnco.com
  Subject: Re: low cardinality column
  In-Reply-To: <1065120643.89807.40.camel@jester>
  References: <33423.207.164.182.8.1065119401.squirrel@mail.cbnco.com> <1065120643.89807.40.camel@jester>

* 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