Re:PostgreSQL Features You May Not Have Tried but Should
by Inviz on Wednesday June 20, 2018 @08:42PM
(#17361158)
select region, count(*) from projects, unnest(region_ids) as region GROUP BY 1;
[ Parent
| on HN ]
Re:PostgreSQL Features You May Not Have Tried but Should
by blattimwind on Thursday June 21, 2018 @07:02PM
(#17369953)
The issue (iirc) with that sort of query is that it's essentially a join, so you'll get count(projects)*sum(length(regions)) intermediate rows that need to be grouped back together.