explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Tf8T

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Unique (cost=16,418.98..16,419.00 rows=2 width=1,354) (actual rows= loops=)

2.          

CTE cte_gl_details

3. 0.000 0.000 ↓ 0.0

Unique (cost=16,383.67..16,383.87 rows=2 width=715) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=16,383.67..16,383.67 rows=2 width=715) (actual rows= loops=)

  • 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
5. 0.000 0.000 ↓ 0.0

Append (cost=60.00..16,383.66 rows=2 width=715) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=60.00..72.06 rows=1 width=218) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

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

  • Recheck Cond: ((gl_reconciliation_id = 28206) AND (cid = 10624) AND (property_id = 584683))
  • Filter: (gl_transaction_type_id = ANY ('{4,5}'::integer[]))
8. 0.000 0.000 ↓ 0.0

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

9. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_gl_details_gl_reconciliation_id (cost=0.00..7.01 rows=343 width=0) (actual rows= loops=)

  • Index Cond: (gl_reconciliation_id = 28206)
10. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_gl_details_cid_property_id (cost=0.00..52.31 rows=2,387 width=0) (actual rows= loops=)

  • Index Cond: ((cid = 10624) AND (property_id = 584683))
11. 0.000 0.000 ↓ 0.0

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

  • 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[])))
12. 0.000 0.000 ↓ 0.0

Nested Loop Semi Join (cost=79.45..16,311.57 rows=1 width=218) (actual rows= loops=)

  • Join Filter: (gd_3.id = gre.gl_detail_id)
13. 0.000 0.000 ↓ 0.0

Nested Loop (cost=79.45..123.55 rows=1 width=218) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on gl_details gd_3 (cost=79.01..115.08 rows=1 width=189) (actual rows= loops=)

  • 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)))
  • Filter: (gl_transaction_type_id = ANY ('{4,5}'::integer[]))
15. 0.000 0.000 ↓ 0.0

BitmapOr (cost=79.01..79.01 rows=9 width=0) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_gl_details_cid_property_id_accrual_gl_account_id (cost=0.00..4.61 rows=4 width=0) (actual rows= loops=)

  • Index Cond: ((cid = 10624) AND (property_id = 584683) AND (accrual_gl_account_id = 160204))
17. 0.000 0.000 ↓ 0.0

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 rows= loops=)

  • Index Cond: ((cid = 10624) AND (property_id = 584683) AND (cash_gl_account_id = 160204))
18. 0.000 0.000 ↓ 0.0

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

  • 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[])))
19. 0.000 0.000 ↓ 0.0

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

  • Filter: ((cid = 10624) AND (gl_reconciliation_id = 28206))
20. 0.000 0.000 ↓ 0.0

Sort (cost=35.12..35.12 rows=2 width=1,354) (actual rows= loops=)

  • Sort Key: sub_query.ap_payment_id, sub_query.ap_header_id, sub_query.gl_transaction_type_id, sub_query.gl_header_id DESC
21. 0.000 0.000 ↓ 0.0

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

22. 0.000 0.000 ↓ 0.0

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

23. 0.000 0.000 ↓ 0.0

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

  • 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
24. 0.000 0.000 ↓ 0.0

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

25. 0.000 0.000 ↓ 0.0

Unique (cost=19.31..19.59 rows=1 width=688) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

WindowAgg (cost=19.31..19.59 rows=1 width=688) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Sort (cost=19.31..19.32 rows=1 width=657) (actual rows= loops=)

  • Sort Key: ap.id
28. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.40..19.30 rows=1 width=657) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.40..14.96 rows=1 width=637) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.98..14.34 rows=1 width=610) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.56..13.68 rows=1 width=614) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..8.50 rows=1 width=610) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

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

  • Filter: ((cid = 10624) AND (gl_transaction_type_id = 4))
34. 0.000 0.000 ↓ 0.0

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

  • Index Cond: ((cid = 10624) AND (gl_transaction_type_id = 4) AND (id = gd.reference_id))
  • Filter: (NOT is_deleted)
35. 0.000 0.000 ↓ 0.0

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

  • 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)))
36. 0.000 0.000 ↓ 0.0

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

37. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = aa.credit_ap_detail_id)
38. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = aa.charge_ap_detail_id)
39. 0.000 0.000 ↓ 0.0

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

  • 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. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = ah.ap_payment_id)
  • Filter: (cid = 10624)
41. 0.000 0.000 ↓ 0.0

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

  • Filter: (id = 4)
42. 0.000 0.000 ↓ 0.0

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

43. 0.000 0.000 ↓ 0.0

Unique (cost=15.09..15.37 rows=1 width=702) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

WindowAgg (cost=15.09..15.37 rows=1 width=702) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Sort (cost=15.09..15.10 rows=1 width=671) (actual rows= loops=)

  • Sort Key: ap_1.id, gd_1.gl_transaction_type_id, ah_1.header_number, ad_1.ap_header_id
46. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.52..15.08 rows=1 width=671) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.38..14.93 rows=1 width=655) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.96..14.31 rows=1 width=628) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.54..13.65 rows=1 width=618) (actual rows= loops=)

50. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..8.49 rows=1 width=614) (actual rows= loops=)

51. 0.000 0.000 ↓ 0.0

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

  • Filter: (cid = 10624)
52. 0.000 0.000 ↓ 0.0

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 rows= loops=)

  • Index Cond: ((cid = 10624) AND (gl_transaction_type_id = gd_1.gl_transaction_type_id) AND (id = gd_1.reference_id))
53. 0.000 0.000 ↓ 0.0

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

  • 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)))
54. 0.000 0.000 ↓ 0.0

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

55. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = aa_1.credit_ap_detail_id)
56. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = aa_1.charge_ap_detail_id)
57. 0.000 0.000 ↓ 0.0

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

  • 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.000 0.000 ↓ 0.0

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

  • Index Cond: (id = ah_1.ap_payment_id)
  • Filter: (cid = 10624)
59. 0.000 0.000 ↓ 0.0

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