QUERY PLAN
Aggregate (cost=87.30..87.31 rows=1 width=8)
-> Sort (cost=87.28..87.29 rows=1 width=214)
Sort Key: s.created_at DESC
-> Group (cost=87.26..87.27 rows=1 width=214)
Group Key: s.id
-> Sort (cost=87.26..87.27 rows=1 width=12)
Sort Key: s.id
-> Hash Right Join (cost=77.15..87.25 rows=1 width=12)
Hash Cond: (turs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_user_relationships turs (cost=0.00..8.13 rows=513 width=4)
-> Hash (cost=77.14..77.14 rows=1 width=12)
-> Nested Loop Left Join (cost=7.42..77.14 rows=1 width=12)
Filter: ((lower((client.name)::text) ~~ '%逾期标签显示问题%'::text) OR (client.pinyin_shortcut ~~ '%逾期标签显示问题%'::text) OR (lower((s.title)::text) ~~ '%逾期标签显示问题%'::text) OR ((s.situation)::text ~~* '%逾期标签显示问题%'::text) OR (lower(s.description) ~~ '%逾期标签显示问题%'::text))
-> Hash Join (cost=7.14..11.76 rows=19 width=289)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..4.58 rows=19 width=4)
Filter: (user_id = 1001)
-> Hash (cost=5.95..5.95 rows=95 width=289)
-> Seq Scan on tbl_task_groups s (cost=0.00..5.95 rows=95 width=289)
-> Index Scan using tbl_clients_pkey on tbl_clients client (cost=0.28..3.41 rows=1 width=59)
Index Cond: (id = s.client_id)
Filter: (NOT deleted)