I've generally used `PARTITION BY` to achieve the same effect in big query (similar to what was suggested in the article for postgres).
Does the `ARRAY_AGG` approach offer any advantages?
Does the `ARRAY_AGG` approach offer any advantages?
The `ARRAY_AGG` approach uses a simple heap, so it's as efficient as MIN/MAX because it can be computed in parallel. ROW_NUMBER however needs all the rows on one machine to number them properly. ARRAY_AGG combination is associative whereas ROW_NUMBER combination isn't.