Ants Aasma <ants.aasma@xxxxxxxx> writes: > Seems that the window aggregate node doesn't take into account that it > has to consume the whole input before outputting the first row. Well, the reason it doesn't assume that is it's not true ;-). In this particular case it's true, but more generally you only have to read the current input partition, and often not even all of that. I'm not sure offhand how much intelligence would have to be added to make a reasonable estimate of the effects of having to read ahead of the current input row, but it's probably not trivial. We haven't spent much time at all yet on creating a realistic cost model for WindowAgg... regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance