QUERY PLAN
Sort (cost=1622.13..1622.38 rows=99 width=62)
Sort Key: sub2.voted_for, sub2."order"
-> Subquery Scan on sub2 (cost=1614.89..1618.85 rows=99 width=62)
-> GroupAggregate (cost=1614.89..1617.86 rows=99 width=62)
Group Key: rv.voted_for, rv.dimension_id, rd.dimension, rd."order"
-> Sort (cost=1614.89..1615.14 rows=99 width=35)
Sort Key: rv.voted_for, rv.dimension_id, rd.dimension, rd."order"
-> Hash Left Join (cost=76.86..1611.61 rows=99 width=35)
Hash Cond: (rv.dimension_id = rd.id)
-> Hash Join (cost=74.64..1609.11 rows=99 width=13)
Hash Cond: (rv.voter = tbl_rating_voters.user_id)
-> Seq Scan on tbl_rating_votes rv (cost=0.00..1532.93 rows=170 width=17)
Filter: (rating_id = 351)
-> Hash (cost=74.49..74.49 rows=12 width=4)
-> HashAggregate (cost=74.37..74.49 rows=12 width=4)
Group Key: tbl_rating_voters.user_id
-> Seq Scan on tbl_rating_voters (cost=0.00..74.34 rows=13 width=4)
Filter: (completed AND (rating_id = 351))
-> 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)