From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Mark Dilger <hornschnorter(at)gmail(dot)com> |
Cc: | Surafel Temesgen <surafel3000(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: FETCH FIRST clause PERCENT option |
Date: | 2018-09-21 00:29:20 |
Message-ID: | 20180921002920.wsufejsz4h3422lz@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2018-09-20 17:06:36 -0700, Mark Dilger wrote:
> I should think that spilling anything to a tuplestore would only be needed
> if the query contains an ORDER BY expression. If you query
>
> FETCH FIRST 50 PERCENT * FROM foo;
>
> you should just return every other row, discarding the rest, right? It's
> only when an explicit ordering is given that the need to store the results
> arises. Even with
>
> FETCH FIRST 50 PERCENT name FROM foo ORDER BY name;
>
> you can return one row for every two rows that you get back from the
> sort node, reducing the maximum number you need to store at any time to
> no more than 25% of all rows.
I'm doubtful about the validity of these optimizations, particularly
around being surprising. But I think more importantly, we should focus
on the basic implementation that's needed anyway.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | David Steele | 2018-09-21 01:14:51 | Re: pgsql: Make WAL segment size configurable at initdb time. |
Previous Message | Mark Dilger | 2018-09-21 00:06:36 | Re: FETCH FIRST clause PERCENT option |