explain.depesz.com

PostgreSQL's explain analyze made readable

Result: SRc

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 4.338 ↑ 1.0 25 1

Limit (cost=119.97..5,417.18 rows=25 width=542) (actual time=1.037..4.338 rows=25 loops=1)

  • Buffers: shared hit=1033, local hit=2
2. 1.418 4.329 ↑ 103.7 25 1

GroupAggregate (cost=119.97..549,546.52 rows=2,593 width=542) (actual time=1.036..4.329 rows=25 loops=1)

  • Group Key: ah.id, ah.cid
  • Buffers: shared hit=1033, local hit=2
3. 0.038 1.976 ↑ 55.2 47 1

Nested Loop (cost=119.97..511,131.22 rows=2,593 width=197) (actual time=0.264..1.976 rows=47 loops=1)

  • Buffers: shared hit=409, local hit=2
4. 0.141 1.797 ↑ 630.7 47 1

Merge Join (cost=119.69..501,720.14 rows=29,641 width=180) (actual time=0.222..1.797 rows=47 loops=1)

  • Merge Cond: (ah.id = ad.ap_header_id)
  • Join Filter: CASE WHEN ((ah.control_total = '0'::numeric) AND (ah.lease_customer_id IS NULL)) THEN (alternatives: SubPlan 7 or hashed SubPlan 8) ELSE (hashed SubPlan 9) END
  • Buffers: shared hit=268, local hit=2
5. 0.618 0.618 ↑ 3,135.0 26 1

Index Scan Backward using pk_ap_headers on ap_headers ah (cost=0.43..59,188.87 rows=81,509 width=160) (actual time=0.090..0.618 rows=26 loops=1)

  • Index Cond: (cid = 14181)
  • Filter: ((ap_payment_id IS NULL) AND (deleted_on IS NULL) AND (NOT is_batching) AND (NOT is_template) AND (reversal_ap_header_id IS NULL) AND (NOT is_on_hold) AND (transaction_amount <> '0'::numeric) AND (ap_financial_status_type_id IS DISTINCT FROM 6) AND (ap_header_type_id = 5) AND (is_posted OR ((NOT is_posted) AND (ap_financial_status_type_id IS DISTINCT FROM 7) AND (ap_financial_status_type_id IS DISTINCT FROM 8))) AND ((ap_header_sub_type_id = ANY ('{5,6,7,8,12,15,100,17}'::integer[])) OR (lease_customer_id IS NOT NULL)))
  • Rows Removed by Filter: 105
  • Buffers: shared hit=90
6. 1.005 1.005 ↑ 2,354.1 465 1

Index Scan Backward using idx_ap_details_cid_apheaderid on ap_details ad (cost=0.43..216,395.60 rows=1,094,663 width=27) (actual time=0.031..1.005 rows=465 loops=1)

  • Index Cond: (cid = 14181)
  • Filter: (deleted_on IS NULL)
  • Buffers: shared hit=178
7.          

SubPlan (for Merge Join)

8. 0.000 0.000 ↓ 0.0 0

Seq Scan on load_properties_info lp (cost=0.00..3.73 rows=1 width=0) (never executed)

  • Filter: (property_id = ad.property_id)
9. 0.014 0.014 ↑ 1.0 84 1

Seq Scan on load_properties_info lp_1 (cost=0.00..3.52 rows=84 width=4) (actual time=0.009..0.014 rows=84 loops=1)

  • Buffers: local hit=1
10. 0.019 0.019 ↑ 1.0 84 1

Seq Scan on load_properties_info (cost=0.00..3.52 rows=84 width=4) (actual time=0.012..0.019 rows=84 loops=1)

  • Buffers: local hit=1
11. 0.141 0.141 ↑ 1.0 1 47

Index Only Scan using idx_properties_cid_id_property_name on properties p (cost=0.28..0.32 rows=1 width=29) (actual time=0.003..0.003 rows=1 loops=47)

  • Index Cond: ((cid = 14181) AND (id = ad.property_id))
  • Heap Fetches: 46
  • Buffers: shared hit=141
12.          

SubPlan (for GroupAggregate)

13. 0.168 0.168 ↑ 1.0 1 24

Index Scan using idx_ap_payees_id on ap_payees ap (cost=0.29..2.33 rows=1 width=20) (actual time=0.007..0.007 rows=1 loops=24)

  • Index Cond: (id = ah.ap_payee_id)
  • Filter: (cid = ah.cid)
  • Buffers: shared hit=72
14. 0.192 0.192 ↑ 1.0 1 24

Index Scan using idx_ap_payee_locations_id on ap_payee_locations apl (cost=0.29..2.33 rows=1 width=12) (actual time=0.008..0.008 rows=1 loops=24)

  • Index Cond: (id = ah.ap_payee_location_id)
  • Filter: (cid = ah.cid)
  • Buffers: shared hit=72
15. 0.050 0.050 ↑ 1.0 1 25

Index Scan using idx_ap_payees_id on ap_payees ap_1 (cost=0.29..2.33 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=25)

  • Index Cond: (id = ah.ap_payee_id)
  • Filter: (cid = ah.cid)
  • Buffers: shared hit=75
16. 0.275 0.275 ↑ 1.0 1 25

Index Scan using idx_ap_payee_accounts_id on ap_payee_accounts apa (cost=0.41..2.46 rows=1 width=11) (actual time=0.010..0.011 rows=1 loops=25)

  • Index Cond: (ah.ap_payee_account_id = id)
  • Filter: (ah.cid = cid)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=101
17. 0.200 0.200 ↑ 1.0 1 25

Index Scan using idx_file_associations_cid_ap_header_id on file_associations fa (cost=0.43..2.47 rows=1 width=0) (actual time=0.008..0.008 rows=1 loops=25)

  • Index Cond: ((cid = ah.cid) AND (ap_header_id = ah.id))
  • Filter: (deleted_on IS NULL)
  • Buffers: shared hit=99
18. 0.050 0.050 ↑ 1.0 1 25

Index Scan using idx_ap_payee_locations_id on ap_payee_locations apl_1 (cost=0.29..2.33 rows=1 width=13) (actual time=0.002..0.002 rows=1 loops=25)

  • Index Cond: (id = ah.ap_payee_location_id)
  • Filter: (cid = ah.cid)
  • Buffers: shared hit=75
Planning time : 7.665 ms
Execution time : 4.654 ms