Re: get counts of multiple field values in a jsonb column

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: get counts of multiple field values in a jsonb column
Дата
Msg-id CAKFQuwZKkv3ZLOfmipU-8JRLKTxhQ4ThFwDJQrX45Fk_MoXUiA@mail.gmail.com
обсуждение исходный текст
Ответ на get counts of multiple field values in a jsonb column  (Martin Norbäck Olivers <martin@norpan.org>)
Список pgsql-sql
On Sat, Oct 17, 2020 at 8:00 AM Martin Norbäck Olivers <martin@norpan.org> wrote:
I'm looking at all the aggregation functions but can't quite find one that suits this purpose.

I would love to get some input on ways to make this faster.

If you want counts the count function is your goto aggregate function.  What you are missing is performing conditional counting.

SELECT fld, count(*) FILTER (WHERE expression) FROM query GROUP BY fld;


David J.

В списке pgsql-sql по дате отправления:

Предыдущее
От: Martin Norbäck Olivers
Дата:
Сообщение: get counts of multiple field values in a jsonb column
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: get counts of multiple field values in a jsonb column