Re: Is postgres able to share sorts required by common partition window functions?

2020-07-07 Thread Sebastien Arod
David G. Johnston < david.g.johns...@gmail.com> wrote: > On Monday, July 6, 2020, Sebastien Arod wrote: > >> I would have expected postgresql to "share" a preliminary sort on c1 that >> would then be useful to reduce the work on all window functions but it >>

Re: Is postgres able to share sorts required by common partition window functions?

2020-07-06 Thread Sebastien Arod
Hi Michael, I simplified the real query before posting it here and I now realize that I oversimplified things. Unfortunately the real query cannot be re-written with a group by. Some of the window functions are more complex with order by clause using complex expressions involving multiple

Is postgres able to share sorts required by common partition window functions?

2020-07-06 Thread Sebastien Arod
Hi all, I'm trying to optimize the following query on postgres 11.6 (running on Aurora) select distinct c1, first_value(c2) OVER (PARTITION BY c1 order by c2) AS c2, first_value(c3) OVER (PARTITION BY c1 order by c3) AS c3, first_value(c4) OVER (PARTITION BY c1 order by c4) AS c4 from

pg_stat_all_tables not updated when VACUUM ANALYZE execution finishes

2018-04-09 Thread Sebastien Arod
Hi, I face a surprising behaviour with VACUUM ANALYZE. For a table with a structure like like this (and few records): create table my_table ( my_column numeric ); When I run the following: VACUUM ANALYZE my_table; SELECT relname, last_analyze, last_vacuum FROM pg_stat_all_tables where