QUERY PLAN
Limit (cost=949.05..949.05 rows=2 width=313)
-> Sort (cost=949.05..949.05 rows=2 width=313)
Sort Key: s.is_draft DESC, s.end_at DESC, s.updated_at DESC
-> Group (cost=949.02..949.04 rows=2 width=313)
Group Key: s.id
-> Sort (cost=949.02..949.03 rows=2 width=297)
Sort Key: s.id
-> Nested Loop (cost=761.51..949.01 rows=2 width=297)
-> Seq Scan on tbl_users u (cost=0.00..8.09 rows=1 width=4)
Filter: ((id = 1000) AND (department_id = 10))
-> Hash Right Join (cost=761.51..940.91 rows=2 width=297)
Hash Cond: (ccr.work_log_id = s.id)
Filter: ((s.created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1017,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5296,5300,5311,5329,5332,5360,5388,5404,5420,5440,5445,5446}'::integer[])) OR (ccr.user_id = 1000))
-> Seq Scan on tbl_work_log_carbon_copy_rels ccr (cost=0.00..144.34 rows=9334 width=8)
-> Hash (cost=761.48..761.48 rows=3 width=297)
-> Hash Left Join (cost=624.00..761.48 rows=3 width=297)
Hash Cond: (s.project_id = p.id)
Filter: ((lower((client.name)::text) ~~ '%test%'::text) OR (client.pinyin_shortcut ~~ '%test%'::text) OR (lower((p.project_title)::text) ~~ '%test%'::text) OR (lower(s.description) ~~ '%test%'::text) OR (lower((wlso.name)::text) ~~ '%test%'::text))
-> Hash Left Join (cost=425.89..563.12 rows=93 width=626)
Hash Cond: (s.scenario_option_id = wlso.id)
-> Hash Left Join (cost=424.01..560.97 rows=93 width=352)
Hash Cond: (s.client_id = client.id)
-> Hash Right Join (cost=295.57..432.30 rows=93 width=297)
Hash Cond: (rvr.work_log_id = s.id)
-> Seq Scan on tbl_work_log_verify_rels rvr (cost=0.00..116.82 rows=7582 width=4)
-> Hash (cost=294.41..294.41 rows=93 width=297)
-> Bitmap Heap Scan on tbl_work_logs s (cost=5.01..294.41 rows=93 width=297)
Recheck Cond: (created_by = 1000)
-> Bitmap Index Scan on tbl_work_logs_created_by_idx (cost=0.00..4.99 rows=93 width=0)
Index Cond: (created_by = 1000)
-> Hash (cost=104.86..104.86 rows=1886 width=59)
-> Seq Scan on tbl_clients client (cost=0.00..104.86 rows=1886 width=59)
Filter: (NOT deleted)
-> Hash (cost=1.39..1.39 rows=39 width=278)
-> Seq Scan on tbl_work_log_scenario_options wlso (cost=0.00..1.39 rows=39 width=278)
-> Hash (cost=163.05..163.05 rows=2805 width=26)
-> Seq Scan on tbl_projects p (cost=0.00..163.05 rows=2805 width=26)