Re: FETCH FIRST clause PERCENT option

From: Surafel Temesgen <surafel3000(at)gmail(dot)com>
To: vik(dot)fearing(at)2ndquadrant(dot)com
Cc: Mark Dilger <hornschnorter(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, andrew(at)tao11(dot)riddles(dot)org(dot)uk
Subject: Re: FETCH FIRST clause PERCENT option
Date: 2018-11-25 11:49:53
Message-ID: CALAY4q9TdEpQo+FLJ6OQWK3fF58W_ROGc4-+wpz+ZiSWXQQApA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Nov 25, 2018 at 1:24 PM Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
wrote:

>
> Also, this query returns 210 rows instead of the expected 208:
>
> select *
> from generate_series(1, 1000)
> fetch first 20.8 percent rows only
>
>

this is because fetch first values work with integer and it change
fractional number to nearest integer number like select * from
generate_series(1, 1000) fetch first 20.3 rows only; is not an error rather
it return 20 rows.

> As for the design, I think you should put some serious consideration
> into Andrew Gierth's approach. I would rather see something like that.
>
>

I didn't go in that direction because I don’t understand why this approach
is inferior to using window function and I am not fully understand on how
to implement it.

regards

Surafel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2018-11-25 12:05:23 Re: FETCH FIRST clause PERCENT option
Previous Message Vik Fearing 2018-11-25 10:24:03 Re: FETCH FIRST clause PERCENT option