QUERY PLAN
GroupAggregate (cost=486.09..486.18 rows=4 width=42)
Group Key: sub.status
-> Sort (cost=486.09..486.10 rows=4 width=8)
Sort Key: sub.status
-> Subquery Scan on sub (cost=485.99..486.05 rows=4 width=8)
-> Group (cost=485.99..486.01 rows=4 width=12)
Group Key: r.id
-> Sort (cost=485.99..486.00 rows=4 width=12)
Sort Key: r.id
-> Hash Left Join (cost=388.25..485.95 rows=4 width=12)
Hash Cond: (r.id = rsvr.erp_collect_ticket_id)
-> Hash Left Join (cost=387.12..484.79 rows=4 width=12)
Hash Cond: (r.id = rvr.erp_collect_ticket_id)
Filter: ((r.created_by = 1001) OR (rvr.user_id = 1001) OR (r.created_by = ANY ('{1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1025,1026,1027,1028,1029,1030,5015,5016,5022,5023,5024,5025,5026,5027,5028,5029,5030,5031,5032,5033,5037,5043,5044,5045,5047,5048,5049,5050,5062,5063,5064,5065,5066,5069,5070,5071,5072,5073,5074,5075,5076,5078,5079,5080,5081,5082,5083,5085,5086,5087,5088,5089,5093,5094,5095,5096,5101,5102,5104,5105,5123,5124,5125,5126,5128,5135,5203,5208,5209,5229,5230,5247,5248,5249,5250,5252,5258,5259,5293,5294,5295,5296,5297,5298,5299,5300,5301,5302,5303,5304,5305,5309,5311,5329,5332,5333,5351,5356,5357,5358,5359,5360,5364,5388,5393,5404,5409,5411,5412,5413,5419,5420,5440,5445,5446,5448,5449,5461,5467,5476,5497,5499,5500}'::integer[])))
-> Hash Left Join (cost=380.71..478.16 rows=5 width=16)
Hash Cond: (r.contact_id = contact.id)
Filter: (((client.name)::text ~~* '%其他%'::text) OR (lower(client.pinyin_shortcut) ~~* '%其他%'::text) OR ((supplier.name)::text ~~* '%其他%'::text) OR (lower(supplier.pinyin_shortcut) ~~* '%其他%'::text) OR ((r.serial_no)::text ~~* '%其他%'::text) OR (r.description ~~* '%其他%'::text) OR (r.abstract ~~* '%其他%'::text) OR ((u.name)::text ~~* '%其他%'::text) OR (lower(u.pinyin_shortcut) ~~* '%其他%'::text) OR ((contact.name)::text ~~* '%其他%'::text) OR (lower(contact.pinyin_shortcut) ~~* '%其他%'::text))
-> Hash Left Join (cost=180.98..272.68 rows=2192 width=178)
Hash Cond: (r.user_id = u.id)
-> Hash Left Join (cost=171.74..257.69 rows=2192 width=170)
Hash Cond: (r.supplier_id = supplier.id)
-> Hash Left Join (cost=133.96..214.15 rows=2192 width=122)
Hash Cond: (r.client_id = client.id)
-> Seq Scan on tbl_erp_collect_tickets r (cost=0.00..74.43 rows=2192 width=71)
Filter: ((status <> 0) OR ((status = 0) AND (created_by = 1001)))
-> Hash (cost=108.98..108.98 rows=1998 width=59)
-> Seq Scan on tbl_clients client (cost=0.00..108.98 rows=1998 width=59)
-> Hash (cost=29.57..29.57 rows=657 width=56)
-> Seq Scan on tbl_suppliers supplier (cost=0.00..29.57 rows=657 width=56)
-> Hash (cost=7.44..7.44 rows=144 width=16)
-> Seq Scan on tbl_users u (cost=0.00..7.44 rows=144 width=16)
-> Hash (cost=139.88..139.88 rows=4788 width=16)
-> Seq Scan on tbl_contacts contact (cost=0.00..139.88 rows=4788 width=16)
-> Hash (cost=3.96..3.96 rows=196 width=8)
-> Seq Scan on tbl_erp_collect_ticket_verify_rels rvr (cost=0.00..3.96 rows=196 width=8)
-> Hash (cost=1.06..1.06 rows=6 width=4)
-> Seq Scan on tbl_erp_collect_ticket_stop_verify_rels rsvr (cost=0.00..1.06 rows=6 width=4)