explain.depesz.com

PostgreSQL's explain analyze made readable

Result: iphN

Settings
# exclusive inclusive rows x rows loops node
1. 0.011 13.286 ↓ 3.5 7 1

Unique (cost=393.74..393.76 rows=2 width=1,354) (actual time=13.272..13.286 rows=7 loops=1)

2.          

CTE cte_gl_details

3. 0.043 7.983 ↓ 13.5 27 1

Unique (cost=358.42..358.62 rows=2 width=715) (actual time=7.929..7.983 rows=27 loops=1)

4. 0.070 7.940 ↓ 13.5 27 1

Sort (cost=358.42..358.43 rows=2 width=715) (actual time=7.928..7.940 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.023 7.870 ↓ 13.5 27 1

Append (cost=60.00..358.41 rows=2 width=715) (actual time=1.932..7.870 rows=27 loops=1)

6. 0.036 2.021 ↓ 17.0 17 1

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

7. 0.019 1.931 ↓ 18.0 18 1

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

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

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

9. 0.014 0.014 ↑ 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.014..0.014 rows=18 loops=1)

  • Index Cond: (gl_reconciliation_id = 28206)
10. 1.896 1.896 ↓ 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=1.895..1.896 rows=27,882 loops=1)

  • Index Cond: ((cid = 10624) AND (property_id = 584683))
11. 0.054 0.054 ↑ 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.003..0.003 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.026 5.826 ↓ 10.0 10 1

Nested Loop (cost=242.23..286.33 rows=1 width=218) (actual time=2.056..5.826 rows=10 loops=1)

13. 1.491 5.760 ↓ 10.0 10 1

Hash Semi Join (cost=241.79..277.86 rows=1 width=189) (actual time=2.045..5.760 rows=10 loops=1)

  • Hash Cond: (gd_3.id = gre.gl_detail_id)
14. 2.583 4.245 ↓ 369.3 3,324 1

Bitmap Heap Scan on gl_details gd_3 (cost=79.02..115.06 rows=9 width=189) (actual time=1.739..4.245 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 1.662 ↓ 0.0 0 1

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

16. 0.250 0.250 ↓ 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.250..0.250 rows=3,324 loops=1)

  • Index Cond: ((cid = 10624) AND (property_id = 584683) AND (accrual_gl_account_id = 160204))
17. 1.410 1.410 ↓ 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=1.410..1.410 rows=3,324 loops=1)

  • Index Cond: ((cid = 10624) AND (property_id = 584683) AND (cash_gl_account_id = 160204))
18. 0.008 0.024 ↑ 13.5 10 1

Hash (cost=161.09..161.09 rows=135 width=4) (actual time=0.023..0.024 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
19. 0.016 0.016 ↑ 13.5 10 1

Index Scan using gl_reconciliation_exceptions_idx on gl_reconciliation_exceptions gre (cost=0.42..161.09 rows=135 width=4) (actual time=0.009..0.016 rows=10 loops=1)

  • Index Cond: (gl_reconciliation_id = 28206)
  • Filter: (cid = 10624)
20. 0.040 0.040 ↑ 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.004..0.004 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.018 13.275 ↓ 3.5 7 1

Sort (cost=35.12..35.12 rows=2 width=1,354) (actual time=13.271..13.275 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.012 13.257 ↓ 3.5 7 1

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

23. 0.021 13.245 ↓ 3.5 7 1

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

24. 0.103 13.224 ↓ 7.0 14 1

Sort (cost=34.99..35.00 rows=2 width=1,350) (actual time=13.216..13.224 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.015 13.121 ↓ 7.0 14 1

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

26. 0.025 10.609 ↓ 7.0 7 1

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

27. 1.553 10.584 ↓ 27.0 27 1

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

28. 0.041 9.031 ↓ 27.0 27 1

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

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

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

30. 0.040 8.800 ↓ 27.0 27 1

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

31. 0.050 8.679 ↓ 27.0 27 1

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

32. 0.056 8.548 ↓ 27.0 27 1

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

33. 0.045 8.168 ↓ 27.0 27 1

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

34. 8.015 8.015 ↓ 27.0 27 1

CTE Scan on cte_gl_details gd (cost=0.00..0.05 rows=1 width=606) (actual time=7.932..8.015 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.081 0.081 ↑ 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.003..0.003 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.015 2.497 ↓ 7.0 7 1

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

44. 0.030 2.482 ↓ 7.0 7 1

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

45. 1.258 2.452 ↓ 27.0 27 1

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

46. 0.060 1.194 ↓ 27.0 27 1

Sort (cost=15.09..15.10 rows=1 width=671) (actual time=1.179..1.194 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.058 1.134 ↓ 27.0 27 1

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

48. 0.046 1.022 ↓ 27.0 27 1

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

49. 0.060 0.868 ↓ 27.0 27 1

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

50. 0.078 0.700 ↓ 27.0 27 1

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

51. 0.059 0.217 ↓ 27.0 27 1

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

52. 0.023 0.023 ↓ 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.023 rows=27 loops=1)

  • Filter: (cid = 10624)
53. 0.135 0.135 ↑ 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.005..0.005 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.189 0.405 ↑ 1.0 1 27

Bitmap Heap Scan on ap_details ad_1 (cost=1.11..5.15 rows=1 width=21) (actual time=0.012..0.015 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.216 ↓ 0.0 0 27

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

56. 0.081 0.081 ↑ 1.0 1 27

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

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

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

  • Index Cond: (id = aa_1.charge_ap_detail_id)
58. 0.108 0.108 ↑ 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.004..0.004 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.108 0.108 ↑ 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.003..0.004 rows=1 loops=27)

  • Index Cond: (id = ah_1.ap_payment_id)
  • Filter: (cid = 10624)
60. 0.054 0.054 ↑ 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.002..0.002 rows=1 loops=27)

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