explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CLNg

Settings
# exclusive inclusive rows x rows loops node
1. 0.656 375.877 ↓ 849.0 849 1

Sort (cost=1,861.93..1,861.93 rows=1 width=202) (actual time=375.805..375.877 rows=849 loops=1)

  • Sort Key: sub.id DESC
  • Sort Method: quicksort Memory: 250kB
2. 0.377 375.221 ↓ 849.0 849 1

Subquery Scan on sub (cost=1,861.85..1,861.92 rows=1 width=202) (actual time=373.226..375.221 rows=849 loops=1)

  • Filter: (sub.cid = 235)
3. 1.497 374.844 ↓ 849.0 849 1

Unique (cost=1,861.85..1,861.90 rows=1 width=206) (actual time=373.222..374.844 rows=849 loops=1)

4. 6.046 373.347 ↓ 1,828.0 1,828 1

Sort (cost=1,861.85..1,861.86 rows=1 width=206) (actual time=373.220..373.347 rows=1,828 loops=1)

  • Sort Key: ap.id, (CASE WHEN ((ad_charge.reimbursement_ap_detail_id IS NOT NULL) OR ((2 = ad_charge.ap_transaction_type_id) AND (1 = ad_charge.reimbursement_method_id)) OR (alternatives: SubPlan 1 or hashed SubPlan 2)) THEN 'true'::text ELSE 'false'::text END), ba.account_name, ap.bank_account_id, apt.name, apt.id, ap.payment_date, ap.payment_amount, (func_format_refund_customer_names(ap.payee_name, false)), ap.payment_number, ah.post_month, ah.id, (CASE WHEN ah.is_initial_import THEN 1 ELSE 0 END), ah1.property_name, (max(ad_charge.property_id) OVER (?)), ap.payment_status_type_id, apl.vendor_code, (CASE WHEN ((ap.ap_payment_type_id = 8) OR (ap.ap_payment_type_id = 9)) THEN CASE WHEN ((gd.gl_reconciliation_id IS NOT NULL) AND (gr.gl_reconciliation_status_type_id = 3)) THEN 'Cleared'::text WHEN ((gd.gl_reconciliation_id IS NOT NULL) AND (gr.gl_reconciliation_status_type_id = 1)) THEN 'Reconciled'::text WHEN (ap.payment_status_type_id = 1) THEN 'Pending'::text WHEN (ap.payment_status_type_id = 2) THEN 'Received [Unreconciled]'::text WHEN (ap.payment_status_type_id = 7) THEN 'Voiding'::text WHEN (ap.payment_status_type_id = 9) THEN 'Capturing'::text WHEN (ap.payment_status_type_id = 10) THEN 'Captured'::text WHEN (ap.payment_status_type_id = 8) THEN 'Voided'::text WHEN (ap.payment_status_type_id = ANY ('{15,30}'::integer[])) THEN 'Returned'::text ELSE NULL::text END WHEN (ap.payment_status_type_id = 8) THEN 'Voided'::text WHEN (ap.payment_status_type_id = ANY ('{15,30}'::integer[])) THEN 'Returned'::text ELSE CASE WHEN ((gd.gl_reconciliation_id IS NOT NULL) AND (gr.gl_reconciliation_status_type_id = 3)) THEN 'Cleared'::text WHEN (gd.gl_reconciliation_id IS NULL) THEN 'Unreconciled'::text ELSE 'Reconciled'::text END END), gr.gl_reconciliation_status_type_id
  • Sort Method: quicksort Memory: 534kB
5. 95.259 367.301 ↓ 1,828.0 1,828 1

WindowAgg (cost=1,859.08..1,861.84 rows=1 width=206) (actual time=249.268..367.301 rows=1,828 loops=1)

6. 3.378 248.004 ↓ 1,828.0 1,828 1

Sort (cost=1,859.08..1,859.09 rows=1 width=152) (actual time=247.509..248.004 rows=1,828 loops=1)

  • Sort Key: ah1.ap_payment_id
  • Sort Method: quicksort Memory: 533kB
7. 2.790 244.626 ↓ 1,828.0 1,828 1

Nested Loop Left Join (cost=1,785.43..1,859.07 rows=1 width=152) (actual time=11.561..244.626 rows=1,828 loops=1)

8. 7.103 241.836 ↓ 1,828.0 1,828 1

Nested Loop Left Join (cost=1,785.15..1,858.77 rows=1 width=152) (actual time=11.553..241.836 rows=1,828 loops=1)

  • Join Filter: ((gd.amount = CASE WHEN ((aa.origin_ap_allocation_id IS NOT NULL) OR (aa.lump_ap_header_id IS NOT NULL)) THEN (aa.allocation_amount * '-1'::numeric) ELSE aa.allocation_amount END) AND (gd.property_id = CASE WHEN (ba.reimbursed_property_id <> aa.property_id) THEN ba.reimbursed_property_id ELSE aa.property_id END))
  • Rows Removed by Join Filter: 2290
  • Filter: (gd.gl_reconciliation_id IS NULL)
  • Rows Removed by Filter: 507
9. 4.324 204.378 ↓ 2,335.0 2,335 1

Nested Loop Left Join (cost=1,784.72..1,856.46 rows=1 width=173) (actual time=11.489..204.378 rows=2,335 loops=1)

10. 4.356 174.369 ↓ 2,335.0 2,335 1

Nested Loop Left Join (cost=1,784.28..1,854.22 rows=1 width=177) (actual time=11.439..174.369 rows=2,335 loops=1)

  • Filter: (ah_charge.reversal_ap_header_id IS NULL)
  • Rows Removed by Filter: 1
11. 4.615 155.997 ↓ 2,336.0 2,336 1

Nested Loop Left Join (cost=1,783.86..1,853.51 rows=1 width=177) (actual time=11.418..155.997 rows=2,336 loops=1)

12. 3.570 121.014 ↓ 2,336.0 2,336 1

Nested Loop Left Join (cost=1,783.44..1,852.21 rows=1 width=157) (actual time=11.364..121.014 rows=2,336 loops=1)

13. 2.064 94.084 ↓ 2,336.0 2,336 1

Nested Loop Left Join (cost=1,783.02..1,851.56 rows=1 width=132) (actual time=11.309..94.084 rows=2,336 loops=1)

14. 3.244 80.340 ↓ 2,336.0 2,336 1

Nested Loop Left Join (cost=1,782.60..1,850.27 rows=1 width=131) (actual time=11.267..80.340 rows=2,336 loops=1)

15. 4.021 67.752 ↓ 2,336.0 2,336 1

Nested Loop Left Join (cost=1,782.18..1,849.02 rows=1 width=135) (actual time=11.221..67.752 rows=2,336 loops=1)

16. 3.128 56.723 ↓ 2,336.0 2,336 1

Nested Loop Left Join (cost=1,781.91..1,847.90 rows=1 width=117) (actual time=11.191..56.723 rows=2,336 loops=1)

17. 2.180 48.923 ↓ 2,336.0 2,336 1

Nested Loop Left Join (cost=1,781.77..1,847.68 rows=1 width=102) (actual time=11.178..48.923 rows=2,336 loops=1)

18. 2.449 35.683 ↓ 1,106.0 1,106 1

Nested Loop (cost=1,781.35..1,845.79 rows=1 width=98) (actual time=11.151..35.683 rows=1,106 loops=1)

19. 1.970 13.970 ↓ 602.0 1,204 1

Hash Join (cost=1,780.93..1,835.51 rows=2 width=81) (actual time=11.055..13.970 rows=1,204 loops=1)

  • Hash Cond: (ah1.ap_payment_id = ap.id)
20. 0.971 0.971 ↑ 1.0 2,088 1

Seq Scan on ah1 (cost=0.00..49.10 rows=2,088 width=29) (actual time=0.011..0.971 rows=2,088 loops=1)

  • Filter: (cid = 235)
21. 0.653 11.029 ↓ 19.0 1,270 1

Hash (cost=1,780.09..1,780.09 rows=67 width=52) (actual time=11.029..11.029 rows=1,270 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 119kB
22. 10.376 10.376 ↓ 19.0 1,270 1

Index Scan using pk_ap_payments on ap_payments ap (cost=0.29..1,780.09 rows=67 width=52) (actual time=0.079..10.376 rows=1,270 loops=1)

  • Index Cond: (cid = 235)
  • Filter: ((NOT is_unclaimed_property) AND (payment_status_type_id <> 8) AND (ap_payment_type_id = ANY ('{6,1,2,4,3,7,5,10,12,13,11}'::integer[])) AND (bank_account_id = ANY ('{4652,4401,4368,3483,3735,2791,4565,4539,3547,2254,3642,3737,1289,4090,285,3837,3265,4241,941,4178,4290,4584,4019,4017,266,3659,2712,4138,3607,3263,3251,3677,5227,4425,3812,3890,2742,3966,4327,1260,660,60,2951,2937,4229,5080,4228,1209,3743,3742,3744,4165,4264,368,652,2097,1077,2021,3324,154,3264,5078,3909,3897,4113,2960,2961,4086,3753,4097,172,3250,3255,5291,4413,2713,3592,3200,4150,559,4119,4024,62,2999,2962,2757,2115,2116,4451,1541,2351,2858,59,2112,1033,1034,1035,1037,3658,2159,870,1559,2000,2123,55,4583,2443,978,979,980,293}'::integer[])))
  • Rows Removed by Filter: 961
23. 19.264 19.264 ↑ 1.0 1 1,204

Index Scan using idx_ap_headers on ap_headers ah (cost=0.42..5.14 rows=1 width=25) (actual time=0.016..0.016 rows=1 loops=1,204)

  • Index Cond: (id = ah1.id)
  • Filter: ((cid = 235) AND (ap_payee_id = ANY ('{436980,373378,377903,199207,318251,296401,353736,346491,315100,293351,389104,293384,293386,293338,68050,334148,293389,293362,369064,294033,323091,370335,370449,332861,334520,293395,293340,337022,293346,298247,332144,358855,310728,301661,67999,293392,67810,337040,67821,68079,318169,204092,337108,293377,309985,67870,372140,331153,335780,335808,322963,67875,293372,360074,67802,67555,369066,367785,67645,202236,327584,332127,67799,323090,373684,351008,338891,403380,238678,379017,323110,67587,321112,333828,67805,67761,67754,317217,67798,330000,323430,67551,316217,293113,389033,62012,61235,61780,60950,61507,293348,67789,368886,372138,61736,62007,371044,61784,368149,67763,67769,67794,368649,67767,67808,67673,199416,68004,203863,334429,61105,67643,321114,67777,61577,367760,62062,67778,61944,61411,61670,61880,61928,62050,60887,67766,67582,67878,299292,61770,61769,61186,62015,330867,325412,377962,323296,323294,323295,297835,392127,61296,338459,61917,376955,398173,401848,385907,396209,389861,61983,60889,67604,300485,351482,299289,67758,67656,67782,67553,332911,67559,299285,62184,61288,61980,61673,373243,359600,323649,334496,319852,413768,360962,438869,358936,358929,373577,373578,373579,327663,61807,61526,61260,61594,61708,61887,61620,61076,67868,61712,61711,376953,62199,356362,61686,61227,61010,61450,318253,61339,297421,61187,61869,61305,61270,61315,60921,315110,61176,62085,61964,293067,299283,61765,61791,62196,61248,62159,61786,61399,67622,329940,62097,61393,61199,61394,61539,61099,61918,61453,61962,61502,430315,373237,374582,61909,67774,373571,62194,61100,61942,327736,61203,61140,61902,61912,61741,61884,61408,61246,62163,61179,61342,386937,61387,61355,300194,67593,62145,62146,61073,62213,61749,68078,61247,62157,61301,62211,67626,61851,373454,374466,60722,67558,61732,350911,60970,350910,62059,336370,327749,327747,67872,67877,433821,373277,434134,373506,435317,67584,61000,62187,61639,368011,373877,368010,367993,367997,368000,368001,368008,368009,61031,293054,61520,61766,323087,318176,61775,60987,433628,433529,53420,298138,315286,299291,67883,61825,61706,61685,67669,62067,61849,62131,368748,368740,62195,61306,62155,61121,61366,61852,67595,67699,61314,60846,60899,61717,385909,386868,386866,382632,61400,61331,62209,61646,61017,67860,67739,299290,299284,61135,61341,199269,61840,62000,61412,62092,61038,62018,316526,61345,61961,61697,61216,67667,61473,62150,61263,62158,62086,61910,60877,61991,67612,3214,68064,61050,60989,61985,368403,314971,61564,61604,403219,334001,62106,62073,61634,61129,61106,293378,67871,4907,200842,61309,316424,300326,62005,60845,67590,61958,315262,62098,61061,60890,67592,315871,315873,315875,61828,61316,334095,61547,62189,61210,351448,351466,351450,351452,351454,351456,351458,351460,351462,351464,61651,309986,61181,61266,61600,61137,62107,61974,61948,62179,67552,62074,61490,61762,61704,67717,61409,60872,60874,61931,356770,61895,62064,203431,201208,61013,62027,61101,7344,438727,199048,198243,200317,155,158,370268,200134,199847,199270,200140,61508,67572,67571,67588,60848,62063,298303,410628,67997,62010,67646,61458,61457,297254,61981,67709,67814,67813,62023,61444,61482,67873,67696,61088,61198,61727,61253,61268,61269,61259,61700,60847,61055,60885,60884,61354,61729,61369,60842,61122,61734,60927,61167,61413,61589,62039,67609,61349,61196,292887,292888,292898,62182,61858,60900,293385,61678,61089,61189,67545,67610,61056,60883,61950,62192,61920,199127,61615,61421,67627,329269,62231,61681,61984,61402,60882,60873,61522,62178,62144,61292,61037,62051,61333,67734,67757,336371,67614,67615,62161,61350,61677,61809,61793,61570,67708,67929,377890,307484,295312,61982,62125,61336,61756,62052,62024,61804,301401,319860,61363,62056,61087,61699,61698,61543,61523,62200,61562,61245,62117,62101,61907,61138,319882,60867,60896,61544,61597,61466,61632,61431,61541,361156,67822,61575,67781,61460,62041,67840,67851,61362,61898,61797,60849,60940,61509,61748,61160,61913,61416,61418,61726,61012,61289,61249,356433,356455,356435,356437,356439,356441,356445,356447,356449,356451,356453,61079,61787,60901,61205,438868,61674,60850,61475,61638,383672,383673,383674,296056,325417,60904,62068,300958,61440,383562,323350,318714,318713,60981,293394,67620,61452,61018,68062,360133,60951,61763,301670,301672,325421,61873,61422,61423,313394,376902,313393,61538,62205,67575,61949,61325,441615,67775,61090,60954,61866,67562,61774,387829,61938,61956,330053,61184,61684,67629,370200,307577,62175,318130,61696,386793,323292,60851,61258,62221,61382,61445,60852,62105,61872,61832,60976,67788,62077,67755,61740,61323,61174,61308,61214,61346,61567,61023,67548,12530,61494,61645,61298,406936,361173,367767,412204,318513,317213,317215,317212,61307,61796,61610,314624,61965,67714,61702,61190,12099,60786,295814,200048,67862,67586,359328,359365,6043,59046,307363,60743,57350,61476,61989,330487,358239,61438,199428,53763,59462,67569,60911,61469,61092,67733,60869,307325,61525,239033,61692,62217,60996,67801,316668,60917,61151,61498,61955,61583,61295,62113,61532,67811,62042,61070,60960,61021,62110,61904,61555,61666,358817,62165,61372,2345,61582,67670,358081,2363,61656,67850,61348,61455,67697,61228,61722,61856,67826,67828,61213,61716,61745,61264,61033,382478,382523,61170,61335,61622,61403,60919,61488,61642,60876,61471,301593,60895,61191,67711,60826,350292,310821,60780,202533,199086,61598,60974,61565,293359,293365,61725,61820,62208,61718,61391,61571,61990,53628,61376,356718,61553,67804,61080,62099,2470,61994,60853,61044,61669,61052,61068,61979,57277,61655,61328,61943,61218,430686,370507,430898,371005,431136,430396,370254,60939,62132,61533,62118,61108,61273,52835,7455,315284,61927,61703,67681,61561,60990,61001,61616,61329,61332,61816,61929,61930,367788,62065,61665,60961,351197,351479,60964,61447,61483,293376,61951,62011,61728,61675,61606,61881,334149,296511,60929,61347,62114,61987,61123,67655,61660,329946,329949,329948,67561,67666,293885,318492,61752,61614,61966,61826,324963,60965,61968,61280,61275,61093,60891,61304,61244,61002,61527,61377,61410,61556,62207,62037,61914,61212,61430,61211,61612,61161,62069,60941,367990,367991,367992,315290,315288,315280,61689,199144,371925,62215,61062,61300,61195,61495,61596,60956,67829,316634,61862,61863,373702,373704,373706,373708,382629,377931,430424,413764,61219,380174,381239,199397,62032,338785,60897,60838,67594,62038,61095,60936,67824,370962,370471,370469,61584,62026,61551,61798,61576,201293,299977,61060,61433,61102,67589,61019,60995,61368,62216,61472,61250,61503,62224,310132,67768,62045,335742,67682,67684,60943,358037,61045,60902,61750,436948,327732,62103,433747,433977,359679,359686,359694,61110,61009,61059,60910,327655,332413,67630,379905,379909,379907,60922,61936,62138,61425,61587,293391,62002,361162,61084,67842,61924,60865,60871,61388,61747,67641,315282,67638,61351,60912,61237,314773,199153,67752,67762,199151,61859,60942,61456,60855,334132,60856,61232,433752,441382,61091,61172,62030,61658,61794,61256,61111,62008,61086,61085,61014,67797,56332,61449,316425,61221,61194,61434,61876,67679,67843,62198,293363,62176,61157,433830,60905,4150,200424,200426,200425,200422,61465,67745,60854,62102,61231,55971,373239,318262,373245,4155,6618,62181,388301,61491,61771,60986,60931,61254,61428,61844,61935,61719,62190,414042,422357,61407,62160,311145,61075,61802,61803,61941,61781,322975,322974,322972,61925,62094,61552,61649,61768,67849,200316,202416,331140,318507,59660,318243,199018,198157,53629,56140,293961,318241,318242,57948,324964,319842,322958,203285,319853,202564,53752,59661,57278,61343,61611,61624,60932,200232,67691,293393,293349,61629,62029,61078,62104,61330,62210,62180,61893,61255,61739,61429,61461,61822,67547,61940,61819,62149,61867,61114,67704,61654,62156,67671,62014,61831,62128,61838,61340,62218,61183,61805,61374,61293,61713,61885,293367,61313,61113,61864,61657,60859,60978,67611,61672,67749,67750,67796,67791,62058,61182,323285,2721,61171,61081,61998,61229,61290,61324,61286,60930,62171,62172,379009,381189,441392,376962,377964,375933,376035,62174,61811,61850,201236,61837,358837,67648,61908,61683,62053,62147,61829,4958,61661,62152,61162,60985,60857,60982,61276,61772,62071,60988,61549,62203,361265,61957,61071,61789,61738,62035,61835,60997,67637,61572,61833,61635,333946,61484,61385,61384,62001,61827,12288,2727,67658,62129,62130,67736,61603,61115,61004,335522,335521,61274,61504,62089,61285,62164,351121,350979,336351,358109,293388,67581,61861,61754,61967,62090,61892,67685,61243,68076,358084,358088,62191,61116,60881,2729,61317,60841,61871,327969,67674,323095,329951,403563,330033,310826,372611,67713,68088,67647,296791,61233,60920,61139,61020,61926,62133,62080,62081,62222,61294,61318,60880,62188,62126,61451,61265,358875,324960,53762,5140,60458,60461,53813,57279,52936,61945,294039,239141,293745,310828,378931,390284,62142,67700,61647,61427,60949,61628,61644,60858,61529,61479,61890,61144,61933,61900,67773,67809,67765,61842,382517,61817,61939,61870,67857,62115,61605,61356,61401,61464,61436,61297,62185,430801,329927,60969,61312,323655,336422,368145,368151,368148,67701,67705,67680,67715,67707,67706,62095,296676,62004,61206,293358,67744,200192,67619,431490,371972,432826,372187,372708,433364,62135,61360,61477,61302,61492,61824,61524,61650,61548,61287,61687,61952,61474,61574,2688,61224,62197,61303,335605,61215,61878,293380,359461,359849,373983,437009,374450,438659,374601,438906,438655,374877,436716,347181,55937,61272,360882,360041,370988,375931,405901,374177,374885,359759,370253,67838,372185,373510,372710,371966,371522,360135,368121,372089,373989,374598,67820,61143,353732,62120,61358,61359,61152,62049,61153,376927,316441,336410,61024,62036,61906,61707,62148,61891,61202,371490,60888,62078,62088,61993,61222,61573,62206,61792,61074,61467,61454,61485,61709,61156,61662,67605,62123,61751,62019,60972,62082,61439,61414,330788,335615,338870,61783,61534,61715,374137,61946,296246,3659,61117,67688,61003,356674,337039,62143,67710,67634,2348,60924,67621,61671,61560,61497,61834,61679,61535,358923,61468,67686,61609,61005,62186,67693,61546,60903,61051,297258,239134,67568,294208,294223,239136,61542,61386,61777,61760,61922,200427,60870,62112,60925,60944,61883,61521,61586,67732,67657,350970,60879,301513,62212,202230,310236,338991,60998,199109,200041,200912,61659,62083,61284,62141,61426,61999,67608,62028,62066,61743,61550,67852,203806,61107,61757,377866,335095,334559,337122,335094,334030,62121,61857,60913,67651,67776,351300,338872,62096,307526,307531,373968,61593,298158,298159,298160,67874,368664,432773,432707,335582,307525,333379,433422,333380,433806,336449,293074,335577,61437,67836,346493,346492,337060,368004,58413,368007,60727,58417,60734,61695,368980,61847,331031,61282,67542,61721,367965,67783,332135,297182,298144,298339,411851,316533,62100,61977,315058,402985,403378,60991,5310,323671,67602,67817,62034,67848,61032,61478,392149,396216,398201,401838,327840,61779,61054,387846,387848,293479,67687,62124,61267,67858,61083,61954,67560,315108,433573,67636,61155,61773,372700,307483,61103,62040,298259,67856,335581,67863,61321,62228,300971,377860,199139,295311,61625,315321,62219,67819,61462,61879,61432,61579,60980,61915,61668,61592,67683,386933,67613,60821,60822,60823,67628,61230,61566,61128,61006,61463,61815,61519,61761,371322,297850,60957,371422,62111,67742,67740,61279,61278,60945,67698,61226,67543,296677,61435,199110,346447,67573,61007,62020,379002,403265,60999,316510,67653,61536,62193,368715,358086,358038,61932,61818,56653,317211,403122,313395,199762,199168,322993,200231,61613,62054,61558,67596,61897,61916,60926,67760,61395,61848,61419,61025,60937,61578,61486,61580,61631,200774,371935,370933,52499,67787,309971,339119,309996,336049,334013,334011,309983,309981,309978,339121,309976,296129,67668,67751,12100,62220,67703,299305,327652,332072,315883,359262,372696,335596,200307,62177,316426,61601,61030,67792,61271,203358,239052,67649,67650,61200,61220,67544,62109,57273,53764,7341,53827,56139,58414,52832,61026,61242,61970,61381,62013,297837,60860,61643,67784,61398,60958,62225,293381,67591,61853,59374,62153,68053,62202,61623,61417,373644,61581,359240,329952,61759,373247,373251,373255,373259,402972,61540,61886,202139,61361,61795,438876,61097,62021,67625,61506,61338,61470,297248,433373,293593,61976,373532,61383,61352,359593,60868,373970,378842,378844,347188,67631,67652,8640,329919,4718,61039,61710,296078,67818,293966,61630,367806,315292,298135,359093,61373,61843,62046,61441,61813,61896,61291,321132,60938,61389,413655,61158,61367,61648,62055,60893,61015,61975,61963,61937,67716,315134,67689,61043,61868,61821,60875,62204,61500,61370,60983,61217,61487,374038,61953,380146,67607,61812,353720,315111,389032,353695,61653,3944,60933,61554,67780,61530,61723,61730,62230,62047,12308,12310,12309,12311,61801,430707,62003,60906,61714,61972,67861,67833,60966,67632,373081,373083,67771,61029,61799,311170,62075,311173,62173,67865,293373,382539,356457,61790,61808,61839,61637,61008,60861,61334,296851,296858,296859,61365,431151,61785,61047,60979,60840,61875,67793,61109,61865,61027,67718,61234,61921,61380,60894,62091,61262,61617,62031,387946,59153,370863,370864,337321,373572,337320,373610,373611,370865,3010,61150,61424,388274,389888,389892,386931,67574,67642,61133,60952,438870,316044,61118,441464,316306,346511,61682,61901,62122,61735,61404,61197,62167,62166,61159,433528,433518,433627,61764,61480,61459,62214,61557,62072,61599,61563,67597,61141,61208,62017,61125,61124,61166,62087,61841,61889,62061,61057,62151,61126,61040,61165,60862,368064,316309,358124,359910,360857,359464,360442,359391,359676,389893,403561,368658,368129,368874,373694,360883,61746,389106,61836,61664,61663,61633,60878,62136,61986,433575,56227,61618,67654,300330,61251,61392,61854,61996,12618,61048,61397,61120,61241,61104,319084,334454,199166,67694,67640,62169,62084,61767,61568,61077,61636,61846,62057,61098,61591,61960,61132,62162,61705,61537,61753,61493,61737,61442,61641,367984,339101,202226,61320,61378,67570,203902,61225,61185,202229,200101,301400,62060,62134,334536,319887,315322,333953,338821,346674,357921,315107,60934,61742,373710,373712,373714,373716,60907,60863,61134,61559,61067,336412,61676,62079,293714,61238,60928,67695,62108,61959,61193,62022,60963,67546,359151,318715,383560,387843,359725,318716,318717,335749,402913,300895,61607,61971,60864,61860,67692,61627,60973,62076,67639,61855,61168,62170,61731,315807,67876,61755,61357,58415,293275,369031,369033,367909,368986,61257,61499,61337,61406,61299,61588,61058,414692,414697,414698,414699,335529,62229,61923,61053,339005,61782,67756,67864,61405,61130,61396,61800,61041,60955,61177,61724,61688,61420,62140,67618,67827,61148,67576,67672,67556,67879,67730,318500,67577,67727,351366,67724,351266,12702,315179,68060,351268,67578,293387,351267,331839,294025,200129,316546,67616,67869,67567,430340,373038,323489,323490,323488,67554,159034,67624,67563,67880,67881,296058,199046,67728,3824,312220,312223,334441,389059,67803,336457,59490,67845,67847,67729,441154,335580,335587,335589,338964,398211,200125,67566,199115,438875,59318,350971,67839,67844,159033,334750,199146,2726,67831,403188,203642,238355,294171,392497,313396,368634,350875,67564,53421,323257,198377,332137,358839,67702,239211,351325,5074,67580,67541,67746,70626,67832,67834,67835,4716,53564,59659,58338,159031,67837,306883,293366,333372,335600,431324,433948,53815,310045,337863,68198,199191,307478,67846,358761,67720,318688,67723,293370,296432,67540,293375,372618,293356,297940,67676,300193,389105,67731,67617,67738,356761,310961,369062,368015,67579,371947,372752,387856,67759,67675,67737,200399,359188,296222,67549,67721,67550,7419,67659,293352,67800,67825,399799,360162,67606,438619,373608,335599,67747,67748,57947,60744,310100,310484,199122,67598,6406,67599,67600,67601,67726,67735,67867,67866,316166,297418,59315,297183,59082,5058,159032,312374,300962,318244,239215,53766,59317,59314,314962,371128,52836,323533,323534,323535,323536,298163,298164,298165,59316,59051,59467,58398,293339,203380,307603,67722,60962,67678,61283,61178,61072,61188,61446,67725,61326,61501,61379,60977,351414,61112,61448,61016,61096,61036,61947,373415,67753,61443,67690,61223,67633,67815,61690,62033,67603,61064,61154,61066,61065,61063,60967,60968,61845,61899,60914,62044,67830,61240,62009,431380,60908,62093,60953,67882,61888,62183,62006,61680,67854,61022,61701,61310,61311,60992,60984,61652,61145,61169,62168,67712,61830,61164,62139,61528,61978,61415,61142,61585,61371,61531,61545,61513,61510,61511,61512,61514,61515,61516,61517,61518,335462,335490,335492,335494,335496,335498,335500,335464,335466,335468,335470,335486,335472,335474,335484,335488,373587,61069,60915,61489,61758,61127,62025,61353,301399,300712,61322,61778,61602,60909,61733,61094,61146,67790,61319,61042,61175,359367,67823,61626,3265,61903,438673,438678,61995,70631,61344,61236,61595,60918,61163,61375,60886,61882,61180,61281,377833,67816,67741,61997,361258,376901,60946,61619,60844,61569,60947,60839,60843,61877,61201,60923,61192,337245,67623,67677,67635,67855,61390,388036,390357,67936,359493,334508,293888,60948,200423,62119,293382,3913,53814,3780,372772,318260,59045,59048,58416,60600,52834,58412,59465,327619,327653,56573,327731,52831,376971,376976,375951,374769,7340,55964,68185,68192,53751,55938,56330,59047,200194,200195,53765,59049,200197,68151,53912,300956,62048,2361,2365,2364,61239,61496,61505,61252,61621,61894,67764,61693,61046,339004,61481,60715,67557,296243,296225,67853,61934,333849,61011,61028,61973,62043,61874,60959,62201,61364,61277,61034,62070,61911,61992,60935,68085,297256,61147,61207,60975,61788,2745,67743,61136,60866,61131,60993,67859,61667,373294,61327,62016,67795,433559,433557,67779,61814,61694,61720,325415,325413,61049,60994,293371,60892,61744,61204,61608,61119,61988,61590,61691,61149,61806,61209,61919,60916,62154,200210,61261,61082,67786,67785,67807,67772,67770,67806,61035,61969,199051,359091,60602,199063,368704,368193,57351,62116,323119,335667,60464,371928,60898,61905,62127,61776,61640,317199,317200,67585,296127,67583,319854,67644,67660,67661,67662,67663,67664,67665,202211,202167,202498,293693,62137,335855,368134,293350,60971,334531,334528,371054,315099,332088,296182}'::integer[])))
  • Rows Removed by Filter: 0
24. 11.060 11.060 ↓ 2.0 2 1,106

Index Scan using idx_ap_details_cid_apheaderid on ap_details ad (cost=0.42..1.88 rows=1 width=20) (actual time=0.008..0.010 rows=2 loops=1,106)

  • Index Cond: ((ah.cid = cid) AND (cid = 235) AND (ah.id = ap_header_id))
  • Filter: ((deleted_by IS NULL) AND (deleted_on IS NULL) AND (ah.gl_transaction_type_id = gl_transaction_type_id) AND (ah.post_month = post_month))
25. 4.672 4.672 ↑ 1.0 1 2,336

Index Scan using pk_ap_payment_types on ap_payment_types apt (cost=0.14..0.21 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=2,336)

  • Index Cond: (id = ap.ap_payment_type_id)
26. 7.008 7.008 ↑ 1.0 1 2,336

Index Scan using idx_bank_accounts on bank_accounts ba (cost=0.28..1.11 rows=1 width=26) (actual time=0.003..0.003 rows=1 loops=2,336)

  • Index Cond: (id = ap.bank_account_id)
  • Filter: ((cid = 235) AND (cid = ap.cid))
  • Rows Removed by Filter: 0
27. 9.344 9.344 ↑ 1.0 1 2,336

Index Scan using idx_ap_payees_id on ap_payees ap1 (cost=0.42..1.24 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=2,336)

  • Index Cond: (id = ah.ap_payee_id)
  • Filter: ((cid = 235) AND (cid = ah.cid))
28. 11.680 11.680 ↑ 1.0 1 2,336

Index Scan using idx_ap_payee_locations_id on ap_payee_locations apl (cost=0.42..1.28 rows=1 width=17) (actual time=0.005..0.005 rows=1 loops=2,336)

  • Index Cond: (id = ah.ap_payee_location_id)
  • Filter: ((cid = 235) AND (cid = ah.cid))
  • Rows Removed by Filter: 0
29. 23.360 23.360 ↑ 1.0 1 2,336

Index Scan using idx_ap_allocations_credit_ap_detail_id on ap_allocations aa (cost=0.42..0.64 rows=1 width=37) (actual time=0.010..0.010 rows=1 loops=2,336)

  • Index Cond: (credit_ap_detail_id = ad.id)
  • Filter: ((cid = 235) AND (cid = ad.cid))
  • Rows Removed by Filter: 0
30. 30.368 30.368 ↑ 1.0 1 2,336

Index Scan using idx_ap_details on ap_details ad_charge (cost=0.42..1.29 rows=1 width=28) (actual time=0.013..0.013 rows=1 loops=2,336)

  • Index Cond: (id = aa.charge_ap_detail_id)
  • Filter: ((cid = 235) AND (cid = aa.cid))
  • Rows Removed by Filter: 0
31. 14.016 14.016 ↑ 1.0 1 2,336

Index Scan using idx_ap_headers on ap_headers ah_charge (cost=0.42..0.70 rows=1 width=12) (actual time=0.006..0.006 rows=1 loops=2,336)

  • Index Cond: (id = ad_charge.ap_header_id)
  • Filter: ((cid = 235) AND (cid = ad_charge.cid))
  • Rows Removed by Filter: 0
32. 25.685 25.685 ↑ 1.0 1 2,335

Index Scan using idx_gl_headers_cid_reference_id on gl_headers gh (cost=0.43..2.23 rows=1 width=16) (actual time=0.011..0.011 rows=1 loops=2,335)

  • Index Cond: ((cid = aa.cid) AND (cid = 235) AND (reference_id = aa.id))
  • Filter: ((gl_transaction_type_id = 4) AND (gl_transaction_type_id = aa.gl_transaction_type_id))
  • Rows Removed by Filter: 0
33. 30.355 30.355 ↓ 2.0 2 2,335

Index Scan using idx_gl_details_cid_gl_header_id on gl_details gd (cost=0.43..2.29 rows=1 width=21) (actual time=0.011..0.013 rows=2 loops=2,335)

  • Index Cond: ((cid = gh.cid) AND (cid = 235) AND (gl_header_id = gh.id))
34. 0.000 0.000 ↓ 0.0 0 1,828

Index Scan using pk_gl_reconciliations on gl_reconciliations gr (cost=0.28..0.30 rows=1 width=12) (actual time=0.000..0.000 rows=0 loops=1,828)

  • Index Cond: ((cid = gd.cid) AND (cid = 235) AND (id = gd.gl_reconciliation_id))
35.          

SubPlan (forWindowAgg)

36. 24.038 24.038 ↓ 0.0 0 1,717

Index Scan using idx_ap_details_cid_apheaderid on ap_details (cost=0.42..2.45 rows=1 width=0) (actual time=0.014..0.014 rows=0 loops=1,717)

  • Index Cond: ((cid = ad_charge.cid) AND (ap_header_id = ad_charge.ap_header_id))
  • Filter: (3 = reimbursement_method_id)
  • Rows Removed by Filter: 7
37. 0.000 0.000 ↓ 0.0 0

Seq Scan on ap_details ap_details_1 (cost=0.00..19,480.16 rows=42 width=8) (never executed)

  • Filter: (3 = reimbursement_method_id)
Planning time : 228.088 ms