Ко дню знаний:
linux=# select users_on.nick, count(*) from (select comments.userid, comments.reactions from comments join topics on comments.topic=topics.id where not comments.deleted and not topics.deleted union all select userid, reactions from topics where not deleted) as messages join users as users_on on (users_on.id=messages.userid), jsonb_each_text(reactions) join users as users_who on (users_who.id=key::int) where value=E'\U0001F921' and not users_on.blocked and not users_who.blocked group by users_on.nick order by count desc limit 20;
nick | count
--------------+-------
alex1101 | 415
ox55ff | 283
Dimez | 210
ips2010 | 202
xwicked | 189
windows10 | 186
Shushundr | 185
LINUX-ORG-RU | 184
hateyoufeel | 180
t184256 | 177
papin-aziat | 172
wandrien | 167
serg002 | 163
firkax | 158
sanyo1234 | 148
Werenter | 139
monkdt | 134
dataman | 126
tempuser003 | 122
SerW | 118
(20 строк)