Re: Windowing Function Patch Review -> Standard Conformance

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Windowing Function Patch Review -> Standard Conformance
Дата
Msg-id 492D3356.2070705@enterprisedb.com
обсуждение исходный текст
Ответ на Re: Windowing Function Patch Review -> Standard Conformance  ("Hitoshi Harada" <umi.tanuki@gmail.com>)
Ответы Re: Windowing Function Patch Review -> Standard Conformance  ("Hitoshi Harada" <umi.tanuki@gmail.com>)
Re: Windowing Function Patch Review -> Standard Conformance  ("Hitoshi Harada" <umi.tanuki@gmail.com>)
Список pgsql-hackers
Hitoshi Harada wrote:
> I read more, and your spooling approach seems flexible for both now
> and the furture. Looking at only current release, the frame with ORDER
> BY is done by detecting peers in WinFrameGetArg() and add row number
> of peers to winobj->currentpos. Actually if we have capability to
> spool all rows we need on demand, the frame would be only a boundary
> problem.

Yeah, we could do that. I'm afraid it would be pretty slow, though, if 
there's a lot of peers. That could probably be alleviated with some sort 
of caching, though.

> It seems to me that eval_windowaggregate() also should use frame APIs.
> Only things we have to care is the shrinking frame, which is not
> supported in this release. So I'd suggest winobj->aggregatedupto to be
> removed. Is there objection?

Actually, I took a different approach in the latest patch. Window 
aggregates now use a separate read pointer into the tuplestore. The 
current row is also read using a separate read pointer in ExecWindow. 
The aggregate and current row read pointers don't need random access, 
which has the nice effect that if you only use window aggregates, not 
window functions, the tuplestore doesn't need random access, and doesn't 
need to spill to disk as long as the window frame fits in work_mem.

We should still figure out how to make it possible to trim the 
tuplestore, when window functions that don't need random access are 
used. Like ROW_NUMBER and RANK. Earlier, I thought we should add 
function to the window object API to explicitly tell that tuples before 
row X are no longer needed. But I'm now starting to wonder if we should 
design the window object API more like the tuplestore API, with a read 
pointer that you can advance forward or backward, and rewind. That would 
probably map more naturally to the underlying tuplestore, and it seems 
like it would be just as easy to use in all the existing window functions.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


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

Предыдущее
От: "Hitoshi Harada"
Дата:
Сообщение: Re: Windowing Function Patch Review -> Standard Conformance
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Brittleness in regression test setup