Re: [HACKERS] Solution for LIMIT cost estimation

From: Chris Bitmead <chrisb(at)nimrod(dot)itg(dot)telstra(dot)com(dot)au>
To: Don Baccus <dhogaza(at)pacifier(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, chris(at)bitmead(dot)com, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Solution for LIMIT cost estimation
Date: 2000-02-11 06:57:59
Message-ID: 38A3B2F7.286CD6ED@nimrod.itg.telecom.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Don Baccus wrote:

> But ... that doesn't mean that some folks might not want to use
> it differently. What if LIMIT 2 were more efficient that COUNT(*)
> in order to determine if more than one row satisfies a condition?

select count(*) > 1 from a;

And if that's not efficient, why not optimise _that_, since it
expresses directly what you want?

> But I wouldn't feel badly at all if LIMIT limited to queries
> with ORDER BY. I think this could be done gramatically, i.e.
>
> [query] ORDER BY

If you are going to limit it thus, it only makes sense if you
either order by a unique key or order by every single column.
Otherwise, why limit it at all? And that can't be determined
gramatically.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Mascari 2000-02-11 07:11:25 Re: [HACKERS] Re: [INTERFACES] The persistance of C functions
Previous Message Michael Meskes 2000-02-11 06:41:10 Re: [HACKERS] psql and libpq fixes