Aggregate (cost=135.23..135.24 rows=1 width=8) |
-> Sort (cost=131.76..132.34 rows=231 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=44.65..122.69 rows=231 width=362) |
Hash Cond: (r.id = rc.rating_id) |
-> Hash Right Join (cost=9.20..81.41 rows=231 width=28) |
Hash Cond: (rvr.rating_id = r.id) |
-> Seq Scan on tbl_rating_voters rvr (cost=0.00..71.61 rows=223 width=4) |
Filter: (user_id = 1001) |
-> Hash (cost=6.31..6.31 rows=231 width=28) |
-> Seq Scan on tbl_ratings r (cost=0.00..6.31 rows=231 width=28) |
-> Hash (cost=35.38..35.38 rows=6 width=4) |
-> Seq Scan on tbl_rating_candidates rc (cost=0.00..35.38 rows=6 width=4) |
Filter: (user_id = 1001) |