Re: LIMIT BASED ON PERCENT

From: Lee Hachadoorian <lee(dot)hachadoorian(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: LIMIT BASED ON PERCENT
Date: 2009-11-18 19:33:53
Message-ID: 5ab13580911181133k6204bbb0h33a695e618bfa02b@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Nov 18, 2009 at 2:30 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> yes, and don't use 20%.
>
> select * from foo order by somecol limit (select (count(*)*0.2)::int from foo)
>
> Regards
> Pavel

Is this faster on a large table? Because (select (count(*)*20/100)) worked fine.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2009-11-18 19:35:22 Re: LIMIT BASED ON PERCENT
Previous Message Pavel Stehule 2009-11-18 19:30:56 Re: LIMIT BASED ON PERCENT