QUERY PLAN
Limit (cost=173.92..173.97 rows=20 width=392)
-> Sort (cost=173.92..174.16 rows=95 width=392)
Sort Key: s.created_at DESC
-> HashAggregate (cost=169.73..171.39 rows=95 width=392)
Group Key: s.id
-> Hash Right Join (cost=156.44..169.09 rows=258 width=376)
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=155.84..155.84 rows=48 width=376)
-> Hash Right Join (cost=150.53..155.84 rows=48 width=376)
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=150.25..150.25 rows=22 width=376)
-> Hash Left Join (cost=144.06..150.25 rows=22 width=376)
Hash Cond: (s.client_id = client.id)
Filter: ((lower((client.name)::text) ~~ '%201%'::text) OR (client.pinyin_shortcut ~~ '%201%'::text) OR (lower((s.title)::text) ~~ '%201%'::text) OR ((s.situation)::text ~~* '%201%'::text) OR (lower(s.description) ~~ '%201%'::text))
-> Seq Scan on tbl_task_groups s (cost=0.00..5.95 rows=95 width=376)
-> 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)