Skip site navigation (1) Skip section navigation (2)

Re: Pls help - Limiting query results by percentage of results

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: josh(at)agliodbs(dot)com
Cc: "Brian G(dot) Huber" <brianghuber(at)yahoo(dot)com>,pgsql-novice(at)postgresql(dot)org
Subject: Re: Pls help - Limiting query results by percentage of results
Date: 2003-08-20 21:47:26
Message-ID: 21235.1061416046@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Josh Berkus <josh(at)agliodbs(dot)com> writes:
>> I am trying to limit the results of a query using the LIMIT clause - but 
>> instead of an absolute number I would like to limit by a percentage of rows
>> returned.  

> We don't have that feature, I'm afraid.   You'd have to write a procedure or
> subroutine which calculated that number an then passed it to LIMIT.

This sounds like a proxy for wanting to know the total number of rows
returned by the query, in advance of executing it.  But the backend has
no better idea than you do how many will be returned :-(

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Michael GrantDate: 2003-08-20 23:19:32
Subject: Re: database design
Previous:From: Josh BerkusDate: 2003-08-20 21:18:41
Subject: Re: Pls help - Limiting query results by percentage of results

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group