Re: another index question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sean Harding <sharding(at)dogcow(dot)org>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: another index question
Date: 2001-04-01 21:22:34
Message-ID: 920.986160154@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

OK, indeed this is a bug --- the planner has a bad interaction for LIMIT
clauses used in "IN" subselects. Will fix.

You could avoid the bug, and get a better plan at the top level anyway,
by writing

SELECT frm,rcpt,subject FROM mesg_headers WHERE mesgnum = (SELECT mesgnum
FROM mesg_headers ORDER BY mesgnum DESC LIMIT 1);

Since you know the subselect is going to produce exactly one tuple,
there's no need to use IN.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joel Burton 2001-04-01 21:24:36 Can I get the default value for an attribute (field) ?
Previous Message ADBAAMD 2001-04-01 21:21:15 Re: Ok, why isn't it using *this* index?