From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Surafel Temesgen <surafel3000(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: FETCH FIRST clause PERCENT option |
Date: | 2018-08-16 14:34:21 |
Message-ID: | 20180816143421.rxla4tonz2dx5xez@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2018-08-16 17:27:45 +0300, Surafel Temesgen wrote:
> FETCH FIRST with PERCENT option is SQL standard that state limit count to
> be specified in a percentage in addition to specify it in exact count and
> listed as one of Major features simply not implemented yet in recent wiki
> page [1].
>
> I implemented it by executing the query plan twice. One without limit
> filter to find the total number of row that will be feed to limit node so
> the exact limit count can be calculated and the query plan execute again
> with limit filter with newly calculated exact count .
Won't that have rather massive issues with multiple evaluations of
clauses in the query? Besides being really expensive?
I think you'd have to instead spill the query results into a tuplestore
(like we do for FOR HOLD queries at end of xact), and then do the
computations based on that.
- Andres
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2018-08-16 14:35:01 | Problem with OpenSCG downloads |
Previous Message | Surafel Temesgen | 2018-08-16 14:27:45 | FETCH FIRST clause PERCENT option |