explain.depesz.com

PostgreSQL's explain analyze made readable

Result: v7yW

Settings
# exclusive inclusive rows x rows loops node
1. 2.008 67.758 ↓ 666.0 666 1

Sort (cost=2,087.24..2,087.24 rows=1 width=2,937) (actual time=67.508..67.758 rows=666 loops=1)

  • Sort Key: ale.receives_1099 DESC, (COALESCE(payment_records.resident_name, CASE WHEN ale.is_show_company_name THEN ((((ale.entity_name)::text || '<br/> '::text) || (ap.company_name)::text))::character varying ELSE ale.entity_name END)), (NULL::integer) DESC, (NULL::integer)
  • Sort Method: quicksort Memory: 339kB
2. 2.283 65.750 ↓ 666.0 666 1

Nested Loop Left Join (cost=2,009.81..2,087.23 rows=1 width=2,937) (actual time=37.173..65.750 rows=666 loops=1)

3. 1.413 62.801 ↓ 666.0 666 1

Nested Loop Left Join (cost=2,009.68..2,087.04 rows=1 width=951) (actual time=37.161..62.801 rows=666 loops=1)

  • Join Filter: ((apl.id IS NULL) AND (ar.cid = ap.cid) AND (ar.ap_payee_id = ap.id))
  • Rows Removed by Join Filter: 2
4. 1.423 61.388 ↓ 666.0 666 1

Nested Loop Left Join (cost=2,009.39..2,085.50 rows=1 width=914) (actual time=37.158..61.388 rows=666 loops=1)

5. 1.303 59.299 ↓ 666.0 666 1

Nested Loop Left Join (cost=2,009.25..2,085.34 rows=1 width=891) (actual time=37.153..59.299 rows=666 loops=1)

6. 1.430 57.330 ↓ 666.0 666 1

Nested Loop Left Join (cost=2,009.12..2,085.18 rows=1 width=885) (actual time=37.148..57.330 rows=666 loops=1)

7. 1.236 53.902 ↓ 666.0 666 1

Nested Loop Left Join (cost=2,008.83..2,084.53 rows=1 width=869) (actual time=37.140..53.902 rows=666 loops=1)

8. 1.084 50.006 ↓ 665.0 665 1

Nested Loop Left Join (cost=2,008.54..2,084.01 rows=1 width=865) (actual time=37.133..50.006 rows=665 loops=1)

  • Join Filter: ((apl.cid = ap.cid) AND (apl.ap_payee_id = ap.id))
9. 0.855 44.267 ↓ 665.0 665 1

Nested Loop Left Join (cost=2,008.25..2,082.53 rows=1 width=776) (actual time=37.125..44.267 rows=665 loops=1)

10. 1.098 42.082 ↓ 665.0 665 1

Nested Loop (cost=2,008.10..2,082.35 rows=1 width=770) (actual time=37.117..42.082 rows=665 loops=1)

  • Join Filter: (payment_records.ap_payee_id = ap.id)
11. 0.875 38.989 ↓ 665.0 665 1

Hash Join (cost=2,007.81..2,081.17 rows=1 width=750) (actual time=37.107..38.989 rows=665 loops=1)

  • Hash Cond: ((payment_records.ap_payee_id = ale.ap_payee_id) AND (payment_records.ap_legal_entity_id = ale.id))
12. 22.303 32.667 ↑ 3.4 665 1

HashAggregate (cost=1,217.88..1,257.08 rows=2,240 width=664) (actual time=31.648..32.667 rows=665 loops=1)

  • Group Key: payment_records.cid, payment_records.ap_payee_id, payment_records.ap_legal_entity_id, payment_records.resident_name
13. 10.364 10.364 ↑ 1.0 22,396 1

Seq Scan on payment_records (cost=0.00..825.95 rows=22,396 width=58) (actual time=0.006..10.364 rows=22,396 loops=1)

  • Filter: (cid = 14,181)
14. 2.423 5.447 ↑ 1.0 4,061 1

Hash (cost=727.53..727.53 rows=4,160 width=94) (actual time=5.446..5.447 rows=4,061 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 463kB
15. 2.825 3.024 ↑ 1.0 4,061 1

Bitmap Heap Scan on ap_legal_entities ale (cost=80.53..727.53 rows=4,160 width=94) (actual time=0.229..3.024 rows=4,061 loops=1)

  • Recheck Cond: (cid = 14,181)
  • Heap Blocks: exact=267
16. 0.199 0.199 ↑ 1.0 4,061 1

Bitmap Index Scan on pk_ap_legal_entities (cost=0.00..79.49 rows=4,160 width=0) (actual time=0.199..0.199 rows=4,061 loops=1)

  • Index Cond: (cid = 14,181)
17. 1.995 1.995 ↑ 1.0 1 665

Index Scan using idx_ap_payees_id on ap_payees ap (cost=0.29..1.17 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=665)

  • Index Cond: (id = ale.ap_payee_id)
  • Filter: (cid = 14,181)
18. 1.330 1.330 ↑ 1.0 1 665

Index Scan using pk_owner_types on owner_types ot (cost=0.15..0.18 rows=1 width=22) (actual time=0.002..0.002 rows=1 loops=665)

  • Index Cond: ((cid = ale.cid) AND (cid = 14,181) AND (id = ale.owner_type_id))
19. 4.655 4.655 ↑ 1.0 1 665

Index Scan using idx_ap_payee_locations_ap_legal_entity_id on ap_payee_locations apl (cost=0.29..1.46 rows=1 width=101) (actual time=0.005..0.007 rows=1 loops=665)

  • Index Cond: (ap_legal_entity_id = ale.id)
  • Filter: (is_primary AND (deleted_on IS NULL) AND (cid = 14,181))
  • Rows Removed by Filter: 4
20. 2.660 2.660 ↑ 1.0 1 665

Index Scan using idx_ap_payee_contact_locations_ap_payee_location_id on ap_payee_contact_locations apcl (cost=0.29..0.52 rows=1 width=12) (actual time=0.003..0.004 rows=1 loops=665)

  • Index Cond: (ap_payee_location_id = apl.id)
  • Filter: ((is_primary IS TRUE) AND (cid = 14,181) AND (cid = apl.cid))
  • Rows Removed by Filter: 1
21. 1.998 1.998 ↑ 1.0 1 666

Index Scan using idx_ap_payee_contacts_id on ap_payee_contacts apc (cost=0.29..0.63 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=666)

  • Index Cond: (id = apcl.ap_payee_contact_id)
  • Filter: ((cid = 14,181) AND (cid = apcl.cid))
22. 0.666 0.666 ↑ 1.0 1 666

Index Scan using pk_form_1099_types on form_1099_types ft (cost=0.13..0.15 rows=1 width=14) (actual time=0.001..0.001 rows=1 loops=666)

  • Index Cond: (ale.form_1099_type_id = id)
23. 0.666 0.666 ↑ 1.0 1 666

Index Scan using pk_form_1099_box_types on form_1099_box_types fbt (cost=0.14..0.17 rows=1 width=31) (actual time=0.001..0.001 rows=1 loops=666)

  • Index Cond: (id = ale.form_1099_box_type_id)
  • Filter: (is_published = 1)
24. 0.000 0.000 ↓ 0.0 0 666

Index Scan using pk_ap_remittances on ap_remittances ar (cost=0.29..1.53 rows=1 width=61) (actual time=0.000..0.000 rows=0 loops=666)

  • Index Cond: ((cid = 14,181) AND (id = ale.ap_remittance_id))
25. 0.666 0.666 ↑ 1.0 1 666

Index Scan using pk_ap_payee_status_types on ap_payee_status_types apst (cost=0.13..0.15 rows=1 width=11) (actual time=0.001..0.001 rows=1 loops=666)

  • Index Cond: (id = ap.ap_payee_status_type_id)