QUERY PLAN
Aggregate (cost=181.59..181.60 rows=1 width=8)
-> Sort (cost=180.16..180.40 rows=95 width=214)
Sort Key: s.created_at DESC
-> HashAggregate (cost=176.09..177.04 rows=95 width=214)
Group Key: s.id
-> Hash Right Join (cost=157.87..174.45 rows=655 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=156.36..156.36 rows=121 width=12)
-> Hash Left Join (cost=151.19..156.36 rows=121 width=12)
Hash Cond: (s.client_id = client.id)
Filter: ((lower((client.name)::text) ~~ '%20%'::text) OR (client.pinyin_shortcut ~~ '%20%'::text) OR (lower((s.title)::text) ~~ '%20%'::text) OR ((s.situation)::text ~~* '%20%'::text) OR (lower(s.description) ~~ '%20%'::text))
-> Hash Right Join (cost=7.14..11.76 rows=206 width=289)
Hash Cond: (thrs.task_group_id = s.id)
-> Seq Scan on tbl_task_group_head_of_relationships thrs (cost=0.00..4.06 rows=206 width=4)
-> 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)
-> Hash (cost=119.58..119.58 rows=1958 width=59)
-> Seq Scan on tbl_clients client (cost=0.00..119.58 rows=1958 width=59)
Filter: (NOT deleted)