Aggregate (cost=111.28..111.29 rows=1 width=8) |
-> Sort (cost=110.81..110.89 rows=31 width=362) |
Sort Key: (CASE WHEN ((r.open_from <= now()) AND (r.close_at >= now())) THEN 1 WHEN (r.open_from > now()) THEN 2 ELSE 3 END), r.created_at DESC |
-> Hash Left Join (cost=41.45..110.04 rows=31 width=362) |
Hash Cond: (r.id = rc.rating_id) |
-> Hash Right Join (cost=7.09..74.89 rows=31 width=28) |
Hash Cond: (rvr.rating_id = r.id) |
-> Seq Scan on tbl_rating_voters rvr (cost=0.00..67.25 rows=208 width=4) |
Filter: (user_id = 1001) |
-> Hash (cost=6.70..6.70 rows=31 width=28) |
-> Seq Scan on tbl_ratings r (cost=0.00..6.70 rows=31 width=28) |
Filter: (rating_type = '2'::smallint) |
-> Hash (cost=34.29..34.29 rows=6 width=4) |
-> Seq Scan on tbl_rating_candidates rc (cost=0.00..34.29 rows=6 width=4) |
Filter: (user_id = 1001) |