Re: FETCH FIRST clause PERCENT option

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: FETCH FIRST clause PERCENT option
Дата
Msg-id 20180921002920.wsufejsz4h3422lz@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: FETCH FIRST clause PERCENT option  (Mark Dilger <hornschnorter@gmail.com>)
Ответы Re: FETCH FIRST clause PERCENT option  (Mark Dilger <hornschnorter@gmail.com>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Mark Dilger
Дата:
Сообщение: Re: FETCH FIRST clause PERCENT option
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Bug fix for glibc broke freebsd build in REL_11_STABLE