3 ms·
Profiled this. Using first_value instead of the additional sub-select made this perform slower at a factor of about 2x for arrays of 1M events. Interesting, an
by drob 11y ago
Profiled this. Using first_value instead of the additional sub-select made this perform slower at a factor of about 2x for arrays of 1M events.
Interesting, and very surprising! I'm going to dig around and see if I can't figure out why this is the case.
I would have guessed there would be a minor performance improvement, because the first_value approach effectively allows PostgreSQL to discard the data sooner, instead of materializing it in an additional subquery.
- dbenhur 11y agoWow... I am surprised. If you gather some useful data please send it on to postgresql-dev and.or postgresql-performance so some core devs can fix it in subsequent releases.