Re: FETCH FIRST clause PERCENT option
От | Andres Freund |
---|---|
Тема | Re: FETCH FIRST clause PERCENT option |
Дата | |
Msg-id | 20180816143421.rxla4tonz2dx5xez@alap3.anarazel.de обсуждение исходный текст |
Ответ на | FETCH FIRST clause PERCENT option (Surafel Temesgen <surafel3000@gmail.com>) |
Ответы |
Re: FETCH FIRST clause PERCENT option
Re: FETCH FIRST clause PERCENT option Re: FETCH FIRST clause PERCENT option |
Список | 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
В списке pgsql-hackers по дате отправления: