QUERY PLAN
GroupAggregate (cost=17.75..17.78 rows=1 width=290)
Group Key: w.scenario_option_id, wso.name
-> Sort (cost=17.75..17.76 rows=1 width=282)
Sort Key: w.scenario_option_id, wso.name
-> Nested Loop Left Join (cost=4.31..17.74 rows=1 width=282)
-> Bitmap Heap Scan on tbl_work_logs w (cost=4.16..9.51 rows=1 width=8)
Recheck Cond: (client_id = 1)
Filter: ((NOT is_draft) AND (scenario_id = 1))
-> Bitmap Index Scan on tbl_work_logs_client_id_idx (cost=0.00..4.16 rows=2 width=0)
Index Cond: (client_id = 1)
-> Index Scan using tbl_work_log_scenario_options_pkey on tbl_work_log_scenario_options wso (cost=0.14..8.16 rows=1 width=278)
Index Cond: (w.scenario_option_id = id)