QUERY PLAN
Subquery Scan on sub (cost=8.30..9.37 rows=1 width=332)
Filter: (sub.id = 58)
-> WindowAgg (cost=8.30..8.96 rows=33 width=332)
-> Sort (cost=8.30..8.38 rows=33 width=324)
Sort Key: sub_1.need_verify_sort, sub_1.created_at DESC
-> Subquery Scan on sub_1 (cost=6.80..7.46 rows=33 width=324)
-> HashAggregate (cost=6.80..7.13 rows=33 width=324)
Group Key: r.id
-> Hash Left Join (cost=4.33..6.06 rows=33 width=328)
Hash Cond: (r.id = rsvr.erp_other_collect_ticket_id)
-> Hash Right Join (cost=3.31..4.91 rows=33 width=324)
Hash Cond: (rvr.erp_other_collect_ticket_id = r.id)
Filter: ((r.created_by = 1013) OR (rvr.user_id = 1013) OR (r.created_by = ANY ('{5030,5351,5026,5203,5025,5072,5105,1004,5299,1001,5037,5446,1027,5045,5087,5094,5123,1008,1029,5048,5043,1025,1003,5208,5305,5078,1015,5449,5358,1023,5064,1026,5089,5027,1007,5258,5135,5076,5071,5209,1028,5083,5081,5033,5440,5229,5104,5359,5393,5412,5409,5062,5360,5247,5015,5023,5126,5124,1022,5022,5311,5248,5128,1000,5333,1006,1014,5093,5297,5249,5095,5082,1012,5070,5096,5420,5063,5102,5028,5259,5445,5448,5298,5075,5388,5230,5073,5404,1021,1030,5069,5066,5079,1020,5252,5364,5309,5411,5301,5049,5419,5044,1018,5088,5031,1013,1013,5074,5413,5125,5101,5024,5300,1016,5293,5250,5047,5029,5304,5296,1005,1017,5050,1019,5080,5032,5085,5332,1011,5086,1002,5065,5294,5357,5329,1010,5356,5016,5295,1009,5302,5303}'::integer[])))
-> Seq Scan on tbl_erp_other_collect_ticket_verify_rels rvr (cost=0.00..1.32 rows=32 width=12)
-> Hash (cost=2.77..2.77 rows=43 width=320)
-> Seq Scan on tbl_erp_other_collect_tickets r (cost=0.00..2.77 rows=43 width=320)
Filter: ((status <> 0) OR ((status = 0) AND (created_by = 1013)))
-> Hash (cost=1.01..1.01 rows=1 width=8)
-> Seq Scan on tbl_erp_other_collect_ticket_stop_verify_rels rsvr (cost=0.00..1.01 rows=1 width=8)