QUERY PLAN
Aggregate (cost=48.79..48.80 rows=1 width=8)
-> Sort (cost=48.77..48.78 rows=1 width=222)
Sort Key: s.created_at DESC
-> Group (cost=48.76..48.76 rows=1 width=222)
Group Key: s.id
-> Sort (cost=48.76..48.76 rows=1 width=12)
Sort Key: s.id
-> Hash Right Join (cost=38.90..48.75 rows=1 width=12)
Hash Cond: (turs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_user_relationships turs (cost=0.00..7.94 rows=494 width=4)
-> Hash (cost=38.89..38.89 rows=1 width=12)
-> Hash Right Join (cost=34.22..38.89 rows=1 width=12)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..3.93 rows=193 width=4)
-> Hash (cost=34.21..34.21 rows=1 width=12)
-> Nested Loop Left Join (cost=8.19..34.21 rows=1 width=12)
Filter: ((lower((client.name)::text) ~~ '%弱店%'::text) OR (client.pinyin_shortcut ~~ '%弱店%'::text) OR (lower((s.title)::text) ~~ '%弱店%'::text) OR (lower(s.description) ~~ '%弱店%'::text))
-> Hash Join (cost=7.91..14.07 rows=6 width=122)
Hash Cond: (s.head_of = u.id)
-> Seq Scan on tbl_task_groups s (cost=0.00..5.91 rows=91 width=126)
-> Hash (cost=7.80..7.80 rows=9 width=4)
-> Seq Scan on tbl_users u (cost=0.00..7.80 rows=9 width=4)
Filter: (department_id = 9)
-> Index Scan using tbl_clients_pkey on tbl_clients client (cost=0.28..3.33 rows=1 width=59)
Index Cond: (id = s.client_id)
Filter: (NOT deleted)