explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Qo6O

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

Unique (cost=314.99..315.01 rows=2 width=1,354) (actual time=164.378..164.390 rows=7 loops=1)

2.          

CTE cte_gl_details

3. 0.075 117.943 ↓ 13.5 27 1

Unique (cost=279.68..279.88 rows=2 width=715) (actual time=117.850..117.943 rows=27 loops=1)

4. 0.137 117.868 ↓ 13.5 27 1

Sort (cost=279.68..279.68 rows=2 width=715) (actual time=117.849..117.868 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.029 117.731 ↓ 13.5 27 1

Append (cost=60.00..279.67 rows=2 width=715) (actual time=13.428..117.731 rows=27 loops=1)

6. 0.065 19.453 ↓ 17.0 17 1

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

7. 1.002 10.892 ↓ 18.0 18 1

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

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

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

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

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

  • Index Cond: ((cid = 10624) AND (property_id = 584683))
11. 8.496 8.496 ↑ 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.472..0.472 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.031 98.249 ↓ 10.0 10 1

Nested Loop (cost=79.88..207.58 rows=1 width=218) (actual time=20.464..98.249 rows=10 loops=1)

13. 4.928 94.868 ↓ 10.0 10 1

Nested Loop Semi Join (cost=79.44..199.11 rows=1 width=189) (actual time=19.277..94.868 rows=10 loops=1)

14. 68.698 79.968 ↓ 369.3 3,324 1

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

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

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

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

  • Index Cond: ((cid = 10624) AND (property_id = 584683) AND (cash_gl_account_id = 160204))
18. 9.972 9.972 ↓ 0.0 0 3,324

Index Scan using gl_reconciliation_exceptions_idx on gl_reconciliation_exceptions gre (cost=0.42..8.45 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=3,324)

  • Index Cond: ((gl_reconciliation_id = 28206) AND (gl_detail_id = gd_3.id))
  • Filter: (cid = 10624)
19. 3.350 3.350 ↑ 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.335..0.335 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[])))
20. 0.024 164.380 ↓ 3.5 7 1

Sort (cost=35.12..35.12 rows=2 width=1,354) (actual time=164.377..164.380 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
21. 0.010 164.356 ↓ 3.5 7 1

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

22. 0.021 164.346 ↓ 3.5 7 1

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

23. 0.136 164.325 ↓ 7.0 14 1

Sort (cost=34.99..35.00 rows=2 width=1,350) (actual time=164.319..164.325 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
24. 0.016 164.189 ↓ 7.0 14 1

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

25. 0.033 161.270 ↓ 7.0 7 1

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

26. 4.053 161.237 ↓ 27.0 27 1

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

27. 0.067 157.184 ↓ 27.0 27 1

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

  • Sort Key: ap.id
  • Sort Method: quicksort Memory: 31kB
28. 0.077 157.117 ↓ 27.0 27 1

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

29. 0.071 155.636 ↓ 27.0 27 1

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

30. 0.071 150.948 ↓ 27.0 27 1

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

31. 0.101 144.775 ↓ 27.0 27 1

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

32. 0.063 123.938 ↓ 27.0 27 1

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

33. 117.989 117.989 ↓ 27.0 27 1

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

  • Filter: ((cid = 10624) AND (gl_transaction_type_id = 4))
34. 5.886 5.886 ↑ 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.218..0.218 rows=1 loops=27)

  • Index Cond: ((cid = 10624) AND (gl_transaction_type_id = 4) AND (id = gd.reference_id))
  • Filter: (NOT is_deleted)
35. 12.258 20.736 ↑ 1.0 1 27

Bitmap Heap Scan on ap_details ad (cost=1.14..5.17 rows=1 width=21) (actual time=0.564..0.768 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
36. 0.054 8.478 ↓ 0.0 0 27

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

37. 4.482 4.482 ↑ 1.0 1 27

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

  • Index Cond: (id = aa.credit_ap_detail_id)
38. 3.942 3.942 ↑ 1.0 1 27

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

  • Index Cond: (id = aa.charge_ap_detail_id)
39. 6.102 6.102 ↑ 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.226..0.226 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))
40. 4.617 4.617 ↑ 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.171..0.171 rows=1 loops=27)

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

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

  • Filter: (id = 4)
  • Rows Removed by Filter: 26
42. 0.015 2.903 ↓ 7.0 7 1

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

43. 0.032 2.888 ↓ 7.0 7 1

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

44. 1.324 2.856 ↓ 27.0 27 1

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

45. 0.072 1.532 ↓ 27.0 27 1

Sort (cost=15.09..15.10 rows=1 width=671) (actual time=1.517..1.532 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
46. 0.062 1.460 ↓ 27.0 27 1

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

47. 0.066 1.317 ↓ 27.0 27 1

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

48. 0.054 1.116 ↓ 27.0 27 1

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

49. 0.108 0.900 ↓ 27.0 27 1

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

50. 0.089 0.279 ↓ 27.0 27 1

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

51. 0.028 0.028 ↓ 27.0 27 1

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

  • Filter: (cid = 10624)
52. 0.162 0.162 ↑ 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.006..0.006 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))
53. 0.216 0.513 ↑ 1.0 1 27

Bitmap Heap Scan on ap_details ad_1 (cost=1.11..5.15 rows=1 width=21) (actual time=0.016..0.019 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
54. 0.081 0.297 ↓ 0.0 0 27

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

55. 0.108 0.108 ↑ 1.0 1 27

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

  • Index Cond: (id = aa_1.credit_ap_detail_id)
56. 0.108 0.108 ↑ 1.0 1 27

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

  • Index Cond: (id = aa_1.charge_ap_detail_id)
57. 0.162 0.162 ↑ 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.006..0.006 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))
58. 0.135 0.135 ↑ 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.005..0.005 rows=1 loops=27)

  • Index Cond: (id = ah_1.ap_payment_id)
  • Filter: (cid = 10624)
59. 0.081 0.081 ↑ 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.003..0.003 rows=1 loops=27)

  • Index Cond: (id = aa_1.gl_transaction_type_id)