explain.depesz.com

PostgreSQL's explain analyze made readable

Result: D6j9 : New plan

Settings
# exclusive inclusive rows x rows loops node
1. 0.010 109.476 ↓ 3.5 7 1

Unique (cost=16,435.96..16,435.98 rows=2 width=1,354) (actual time=109.464..109.476 rows=7 loops=1)

2.          

CTE cte_gl_details

3. 0.047 106.001 ↓ 13.5 27 1

Unique (cost=16,400.65..16,400.85 rows=2 width=715) (actual time=105.942..106.001 rows=27 loops=1)

4. 0.088 105.954 ↓ 13.5 27 1

Sort (cost=16,400.65..16,400.65 rows=2 width=715) (actual time=105.940..105.954 rows=27 loops=1)

  • Sort Key: gd_2.id, gd_2.cid, gd_2.period_id, gd_2.property_id, gd_2.gl_header_id, gd_2.gl_transaction_type_id, gd_2.accrual_gl_account_id, gd_2.cash_gl_account_id, gd_2.template_amount_type_id, gd_2.template_balance_from_id, gd_2.lease_id, gd_2.property_unit_id, gd_2.gl_reconciliation_id, gd_2.ap_detail_id, gd_2.offsetting_gl_detail_id, gd_2.gl_export_batch_id, gd_2.company_department_id, gd_2.gl_dimension_id, gd_2.ap_payee_location_id, gd_2.ap_code_id, gd_2.ar_code_id, gd_2.reference_id, gd_2.job_phase_id, gd_2.ap_contract_id, gd_2.asset_id, gd_2.property_building_id, gd_2.reclass_gl_detail_id, gd_2.post_month, gd_2.amount, gd_2.memo, gd_2.is_confidential, gd_2.updated_by, gd_2.updated_on, gd_2.created_by, gd_2.created_on, gd_2.maintenance_location_id, gd_2.unit_type_id, gh.post_date, gh.memo
  • Sort Method: quicksort Memory: 31kB
5. 0.027 105.866 ↓ 13.5 27 1

Append (cost=60.00..16,400.64 rows=2 width=715) (actual time=3.046..105.866 rows=27 loops=1)

6. 0.046 3.199 ↓ 17.0 17 1

Nested Loop (cost=60.00..72.06 rows=1 width=218) (actual time=3.045..3.199 rows=17 loops=1)

7. 0.031 3.045 ↓ 18.0 18 1

Bitmap Heap Scan on gl_details gd_2 (cost=59.57..63.59 rows=1 width=189) (actual time=3.022..3.045 rows=18 loops=1)

  • Recheck Cond: ((gl_reconciliation_id = 28206) AND (cid = 10624) AND (property_id = 584683))
  • Heap Blocks: exact=5
8. 0.003 3.014 ↓ 0.0 0 1

BitmapAnd (cost=59.57..59.57 rows=1 width=0) (actual time=3.014..3.014 rows=0 loops=1)

9. 0.020 0.020 ↑ 19.1 18 1

Bitmap Index Scan on idx_gl_details_gl_reconciliation_id (cost=0.00..7.01 rows=343 width=0) (actual time=0.019..0.020 rows=18 loops=1)

  • Index Cond: (gl_reconciliation_id = 28206)
10. 2.991 2.991 ↓ 11.7 27,882 1

Bitmap Index Scan on idx_gl_details_cid_property_id (cost=0.00..52.31 rows=2,387 width=0) (actual time=2.990..2.991 rows=27,882 loops=1)

  • Index Cond: ((cid = 10624) AND (property_id = 584683))
11. 0.108 0.108 ↑ 1.0 1 18

Index Scan using idx_gl_headers_id on gl_headers gh (cost=0.43..8.47 rows=1 width=41) (actual time=0.006..0.006 rows=1 loops=18)

  • Index Cond: (id = gd_2.gl_header_id)
  • Filter: ((gl_transaction_type_id = ANY ('{4,5}'::integer[])) AND (cid = 10624) AND (gd_2.gl_transaction_type_id = gl_transaction_type_id) AND (gl_header_status_type_id <> ALL ('{2,4,5,6}'::integer[])))
  • Rows Removed by Filter: 0
12. 0.029 102.640 ↓ 10.0 10 1

Nested Loop (cost=79.45..16,328.55 rows=1 width=218) (actual time=72.698..102.640 rows=10 loops=1)

13. 17.080 102.551 ↓ 10.0 10 1

Nested Loop Semi Join (cost=79.02..16,320.08 rows=1 width=189) (actual time=72.673..102.551 rows=10 loops=1)

  • Join Filter: (gd_3.id = gre.gl_detail_id)
  • Rows Removed by Join Filter: 33185
14. 2.866 5.695 ↓ 369.3 3,324 1

Bitmap Heap Scan on gl_details gd_3 (cost=79.02..115.06 rows=9 width=189) (actual time=2.976..5.695 rows=3,324 loops=1)

  • Recheck Cond: (((cid = 10624) AND (property_id = 584683) AND (accrual_gl_account_id = 160204)) OR ((cid = 10624) AND (property_id = 584683) AND (cash_gl_account_id = 160204)))
  • Heap Blocks: exact=724
15. 0.002 2.829 ↓ 0.0 0 1

BitmapOr (cost=79.02..79.02 rows=9 width=0) (actual time=2.829..2.829 rows=0 loops=1)

16. 0.421 0.421 ↓ 831.0 3,324 1

Bitmap Index Scan on idx_gl_details_cid_property_id_accrual_gl_account_id (cost=0.00..4.61 rows=4 width=0) (actual time=0.421..0.421 rows=3,324 loops=1)

  • Index Cond: ((cid = 10624) AND (property_id = 584683) AND (accrual_gl_account_id = 160204))
17. 2.406 2.406 ↓ 831.0 3,324 1

Bitmap Index Scan on idx_gl_details_cid_property_id_post_month_cash_gl_account_id (cost=0.00..74.40 rows=4 width=0) (actual time=2.406..2.406 rows=3,324 loops=1)

  • Index Cond: ((cid = 10624) AND (property_id = 584683) AND (cash_gl_account_id = 160204))
18. 12.096 79.776 ↑ 13.6 10 3,324

Materialize (cost=0.00..16,187.00 rows=136 width=4) (actual time=0.021..0.024 rows=10 loops=3,324)

19. 67.680 67.680 ↑ 13.6 10 1

Seq Scan on gl_reconciliation_exceptions gre (cost=0.00..16,186.32 rows=136 width=4) (actual time=67.654..67.680 rows=10 loops=1)

  • Filter: ((cid = 10624) AND (gl_reconciliation_id = 28206))
  • Rows Removed by Filter: 693678
20. 0.060 0.060 ↑ 1.0 1 10

Index Scan using idx_gl_headers_id on gl_headers gh_1 (cost=0.43..8.47 rows=1 width=41) (actual time=0.006..0.006 rows=1 loops=10)

  • Index Cond: (id = gd_3.gl_header_id)
  • Filter: ((gl_transaction_type_id = ANY ('{4,5}'::integer[])) AND (post_date <= '2019-05-01'::date) AND (cid = 10624) AND (gd_3.gl_transaction_type_id = gl_transaction_type_id) AND (gl_header_status_type_id <> ALL ('{2,4,5,6}'::integer[])))
21. 0.019 109.466 ↓ 3.5 7 1

Sort (cost=35.12..35.12 rows=2 width=1,354) (actual time=109.463..109.466 rows=7 loops=1)

  • Sort Key: sub_query.ap_payment_id, sub_query.ap_header_id, sub_query.gl_transaction_type_id, sub_query.gl_header_id DESC
  • Sort Method: quicksort Memory: 26kB
22. 0.009 109.447 ↓ 3.5 7 1

Subquery Scan on sub_query (cost=34.99..35.11 rows=2 width=1,354) (actual time=109.420..109.447 rows=7 loops=1)

23. 0.017 109.438 ↓ 3.5 7 1

Unique (cost=34.99..35.09 rows=2 width=1,350) (actual time=109.417..109.438 rows=7 loops=1)

24. 0.068 109.421 ↓ 7.0 14 1

Sort (cost=34.99..35.00 rows=2 width=1,350) (actual time=109.416..109.421 rows=14 loops=1)

  • Sort Key: ap.id, ap.payment_number, ap.payment_number, (func_format_refund_customer_names(ap.payee_name, false)), ap.ap_payment_type_id, ah.id, gd.gh_post_date, gd.post_month, (sum(gd.amount) OVER (?)), gd.gl_header_id, gd.property_id, gd.accrual_gl_account_id, gd.cash_gl_account_id, gtt.description, gd.gl_transaction_type_id, gd.gl_reconciliation_id, gd.gh_memo, gd.memo
  • Sort Method: quicksort Memory: 28kB
25. 0.014 109.353 ↓ 7.0 14 1

Append (cost=19.31..34.98 rows=2 width=1,350) (actual time=107.206..109.353 rows=14 loops=1)

26. 0.022 107.840 ↓ 7.0 7 1

Unique (cost=19.31..19.59 rows=1 width=688) (actual time=107.205..107.840 rows=7 loops=1)

27. 0.720 107.818 ↓ 27.0 27 1

WindowAgg (cost=19.31..19.59 rows=1 width=688) (actual time=107.203..107.818 rows=27 loops=1)

28. 0.043 107.098 ↓ 27.0 27 1

Sort (cost=19.31..19.32 rows=1 width=657) (actual time=107.087..107.098 rows=27 loops=1)

  • Sort Key: ap.id
  • Sort Method: quicksort Memory: 31kB
29. 0.050 107.055 ↓ 27.0 27 1

Nested Loop (cost=2.40..19.30 rows=1 width=657) (actual time=106.041..107.055 rows=27 loops=1)

30. 0.043 106.870 ↓ 27.0 27 1

Nested Loop (cost=2.40..14.96 rows=1 width=637) (actual time=106.032..106.870 rows=27 loops=1)

31. 0.041 106.746 ↓ 27.0 27 1

Nested Loop (cost=1.98..14.34 rows=1 width=610) (actual time=106.017..106.746 rows=27 loops=1)

32. 0.074 106.597 ↓ 27.0 27 1

Nested Loop (cost=1.56..13.68 rows=1 width=614) (actual time=106.000..106.597 rows=27 loops=1)

33. 0.054 106.199 ↓ 27.0 27 1

Nested Loop (cost=0.42..8.50 rows=1 width=610) (actual time=105.966..106.199 rows=27 loops=1)

34. 106.037 106.037 ↓ 27.0 27 1

CTE Scan on cte_gl_details gd (cost=0.00..0.05 rows=1 width=606) (actual time=105.946..106.037 rows=27 loops=1)

  • Filter: ((cid = 10624) AND (gl_transaction_type_id = 4))
35. 0.108 0.108 ↑ 1.0 1 27

Index Scan using idx_ap_allocations_cid_gltrans_id_prop on ap_allocations aa (cost=0.42..8.45 rows=1 width=20) (actual time=0.004..0.004 rows=1 loops=27)

  • Index Cond: ((cid = 10624) AND (gl_transaction_type_id = 4) AND (id = gd.reference_id))
  • Filter: (NOT is_deleted)
36. 0.135 0.324 ↑ 1.0 1 27

Bitmap Heap Scan on ap_details ad (cost=1.14..5.17 rows=1 width=21) (actual time=0.010..0.012 rows=1 loops=27)

  • Recheck Cond: ((id = aa.credit_ap_detail_id) OR (id = aa.charge_ap_detail_id))
  • Filter: ((cid = 10624) AND ((id = aa.credit_ap_detail_id) OR ((id = aa.charge_ap_detail_id) AND is_cross_allocation)))
  • Rows Removed by Filter: 1
  • Heap Blocks: exact=54
37. 0.027 0.189 ↓ 0.0 0 27

BitmapOr (cost=1.14..1.14 rows=2 width=0) (actual time=0.007..0.007 rows=0 loops=27)

38. 0.081 0.081 ↑ 1.0 1 27

Bitmap Index Scan on idx_ap_details (cost=0.00..0.57 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=27)

  • Index Cond: (id = aa.credit_ap_detail_id)
39. 0.081 0.081 ↑ 1.0 1 27

Bitmap Index Scan on idx_ap_details (cost=0.00..0.57 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=27)

  • Index Cond: (id = aa.charge_ap_detail_id)
40. 0.108 0.108 ↑ 1.0 1 27

Index Scan using idx_ap_headers on ap_headers ah (cost=0.42..0.65 rows=1 width=20) (actual time=0.004..0.004 rows=1 loops=27)

  • Index Cond: (id = ad.ap_header_id)
  • Filter: ((cid = 10624) AND (ad.gl_transaction_type_id = gl_transaction_type_id) AND (ad.post_month = post_month))
41. 0.081 0.081 ↑ 1.0 1 27

Index Scan using idx_ap_payments_id on ap_payments ap (cost=0.42..0.62 rows=1 width=39) (actual time=0.003..0.003 rows=1 loops=27)

  • Index Cond: (id = ah.ap_payment_id)
  • Filter: (cid = 10624)
42. 0.135 0.135 ↑ 1.0 1 27

Seq Scan on gl_transaction_types gtt (cost=0.00..4.34 rows=1 width=24) (actual time=0.001..0.005 rows=1 loops=27)

  • Filter: (id = 4)
  • Rows Removed by Filter: 26
43. 0.011 1.499 ↓ 7.0 7 1

Subquery Scan on "*SELECT* 2" (cost=15.09..15.38 rows=1 width=688) (actual time=0.863..1.499 rows=7 loops=1)

44. 0.023 1.488 ↓ 7.0 7 1

Unique (cost=15.09..15.37 rows=1 width=702) (actual time=0.861..1.488 rows=7 loops=1)

45. 0.646 1.465 ↓ 27.0 27 1

WindowAgg (cost=15.09..15.37 rows=1 width=702) (actual time=0.858..1.465 rows=27 loops=1)

46. 0.051 0.819 ↓ 27.0 27 1

Sort (cost=15.09..15.10 rows=1 width=671) (actual time=0.808..0.819 rows=27 loops=1)

  • Sort Key: ap_1.id, gd_1.gl_transaction_type_id, ah_1.header_number, ad_1.ap_header_id
  • Sort Method: quicksort Memory: 32kB
47. 0.049 0.768 ↓ 27.0 27 1

Nested Loop (cost=2.52..15.08 rows=1 width=671) (actual time=0.057..0.768 rows=27 loops=1)

48. 0.053 0.692 ↓ 27.0 27 1

Nested Loop (cost=2.38..14.93 rows=1 width=655) (actual time=0.049..0.692 rows=27 loops=1)

49. 0.032 0.585 ↓ 27.0 27 1

Nested Loop (cost=1.96..14.31 rows=1 width=628) (actual time=0.041..0.585 rows=27 loops=1)

50. 0.056 0.472 ↓ 27.0 27 1

Nested Loop (cost=1.54..13.65 rows=1 width=618) (actual time=0.031..0.472 rows=27 loops=1)

51. 0.048 0.146 ↓ 27.0 27 1

Nested Loop (cost=0.42..8.49 rows=1 width=614) (actual time=0.013..0.146 rows=27 loops=1)

52. 0.017 0.017 ↓ 27.0 27 1

CTE Scan on cte_gl_details gd_1 (cost=0.00..0.04 rows=1 width=606) (actual time=0.001..0.017 rows=27 loops=1)

  • Filter: (cid = 10624)
53. 0.081 0.081 ↑ 1.0 1 27

Index Scan using idx_ap_allocations_cid_gltrans_id_prop on ap_allocations aa_1 (cost=0.42..8.45 rows=1 width=20) (actual time=0.003..0.003 rows=1 loops=27)

  • Index Cond: ((cid = 10624) AND (gl_transaction_type_id = gd_1.gl_transaction_type_id) AND (id = gd_1.reference_id))
54. 0.108 0.270 ↑ 1.0 1 27

Bitmap Heap Scan on ap_details ad_1 (cost=1.11..5.15 rows=1 width=21) (actual time=0.008..0.010 rows=1 loops=27)

  • Recheck Cond: ((id = aa_1.credit_ap_detail_id) OR (id = aa_1.charge_ap_detail_id))
  • Filter: ((cid = 10624) AND ((id = aa_1.credit_ap_detail_id) OR ((id = aa_1.charge_ap_detail_id) AND is_cross_allocation)))
  • Rows Removed by Filter: 1
  • Heap Blocks: exact=54
55. 0.054 0.162 ↓ 0.0 0 27

BitmapOr (cost=1.11..1.11 rows=2 width=0) (actual time=0.006..0.006 rows=0 loops=27)

56. 0.054 0.054 ↑ 1.0 1 27

Bitmap Index Scan on idx_ap_details (cost=0.00..0.56 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=27)

  • Index Cond: (id = aa_1.credit_ap_detail_id)
57. 0.054 0.054 ↑ 1.0 1 27

Bitmap Index Scan on idx_ap_details (cost=0.00..0.56 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=27)

  • Index Cond: (id = aa_1.charge_ap_detail_id)
58. 0.081 0.081 ↑ 1.0 1 27

Index Scan using idx_ap_headers on ap_headers ah_1 (cost=0.42..0.65 rows=1 width=30) (actual time=0.003..0.003 rows=1 loops=27)

  • Index Cond: (id = ad_1.ap_header_id)
  • Filter: ((cid = 10624) AND (ad_1.gl_transaction_type_id = gl_transaction_type_id) AND (ad_1.post_month = post_month))
59. 0.054 0.054 ↑ 1.0 1 27

Index Scan using idx_ap_payments_id on ap_payments ap_1 (cost=0.42..0.62 rows=1 width=39) (actual time=0.002..0.002 rows=1 loops=27)

  • Index Cond: (id = ah_1.ap_payment_id)
  • Filter: (cid = 10624)
60. 0.027 0.027 ↑ 1.0 1 27

Index Scan using pk_gl_transaction_types on gl_transaction_types gtt_1 (cost=0.14..0.16 rows=1 width=24) (actual time=0.001..0.001 rows=1 loops=27)

  • Index Cond: (id = aa_1.gl_transaction_type_id)
Planning time : 24.034 ms