4 ms·
Faceting is really useful, but quite expensive if implemented in a naive way in Postgres. This looks very interesting, but the really annoying thing about requi
by fabian2k 4y ago
Faceting is really useful, but quite expensive if implemented in a naive way in Postgres. This looks very interesting, but the really annoying thing about requiring a Postgres extension is that you can't use it with most managed Postgres services.
What is the best way to calculate facets in Postgres when you can't rely on the ability to install an extension? The naive way would be a bunch of "count(*) group by" queries, a slightly less naive way would be to do the same using grouping sets if possible. But are there any other tricks one could use to calculate facets for large, but not impossibly large numbers of rows?
- danielheath 4y ago‘select count(1) filter by x, count(1) filter by y ‘ might be faster?
- SahAssar 4y agoThe faceting extension itself is pure sql, but it does depend on pg_roaringbitmap which is a C extension.