QUERY PLAN
Sort (cost=1582.76..1583.00 rows=98 width=62)
Sort Key: sub2.voted_for, sub2."order"
-> Subquery Scan on sub2 (cost=1575.59..1579.51 rows=98 width=62)
-> GroupAggregate (cost=1575.59..1578.53 rows=98 width=62)
Group Key: rv.voted_for, rv.dimension_id, rd.dimension, rd."order"
-> Sort (cost=1575.59..1575.84 rows=98 width=35)
Sort Key: rv.voted_for, rv.dimension_id, rd.dimension, rd."order"
-> Hash Left Join (cost=74.54..1572.35 rows=98 width=35)
Hash Cond: (rv.dimension_id = rd.id)
-> Hash Join (cost=72.33..1569.86 rows=98 width=13)
Hash Cond: (rv.voter = tbl_rating_voters.user_id)
-> Seq Scan on tbl_rating_votes rv (cost=0.00..1496.00 rows=168 width=17)
Filter: (rating_id = 343)
-> Hash (cost=72.18..72.18 rows=12 width=4)
-> HashAggregate (cost=72.06..72.18 rows=12 width=4)
Group Key: tbl_rating_voters.user_id
-> Seq Scan on tbl_rating_voters (cost=0.00..72.03 rows=13 width=4)
Filter: (completed AND (rating_id = 343))
-> Hash (cost=1.54..1.54 rows=54 width=26)
-> Seq Scan on tbl_rating_dimensions rd (cost=0.00..1.54 rows=54 width=26)