explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YmVB : Join billItemAudit

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 80.470 600.651 ↑ 25.0 13,058 1

Merge Join (cost=49,623.02..76,133.51 rows=326,838 width=47) (actual time=549.986..600.651 rows=13,058 loops=1)

  • Merge Cond: (billitemsa3_.audit_package_item_id = auditpacka0_.id)
2. 448.083 448.083 ↑ 31.8 153,187 1

Index Scan using bill_item_audit_audit_package_item_id_ix on bill_item_audit billitemsa3_ (cost=0.43..973,394.82 rows=4,863,886 width=8) (actual time=2.351..448.083 rows=153,187 loops=1)

  • Filter: (subscription_id = ANY ('{158498,12096,158499,158496,158497,111433,111434,400,157526,157524,157525,12094,350}'::bigint[]))
  • Rows Removed by Filter: 35621
3. 9.041 72.098 ↓ 2.0 13,057 1

Sort (cost=49,622.48..49,639.21 rows=6,692 width=47) (actual time=69.496..72.098 rows=13,057 loops=1)

  • Sort Key: auditpacka0_.id
  • Sort Method: quicksort Memory: 998kB
4. 3.057 63.057 ↑ 1.0 6,486 1

Merge Join (cost=0.99..49,197.26 rows=6,692 width=47) (actual time=1.547..63.057 rows=6,486 loops=1)

  • Merge Cond: (auditpacka2_.id = auditpacka0_.audit_package_id)
5. 0.799 0.799 ↑ 1.0 211 1

Index Only Scan using audit_package_pkey on audit_package auditpacka2_ (cost=0.14..23.31 rows=211 width=8) (actual time=0.334..0.799 rows=211 loops=1)

  • Heap Fetches: 151
6. 4.594 59.201 ↑ 1.0 6,486 1

Materialize (cost=0.85..52,485.77 rows=6,692 width=47) (actual time=0.728..59.201 rows=6,486 loops=1)

7. 9.023 54.607 ↑ 1.0 6,486 1

Nested Loop (cost=0.85..52,469.04 rows=6,692 width=47) (actual time=0.713..54.607 rows=6,486 loops=1)

8. 13.154 13.154 ↑ 1.0 6,486 1

Index Scan using audit_package_item_audit_package_id_ix on audit_package_item auditpacka0_ (cost=0.42..3,571.45 rows=6,692 width=39) (actual time=0.668..13.154 rows=6,486 loops=1)

  • Index Cond: (audit_package_id = ANY ('{587272,585865,587371,587373,587375,583713,587364,585894,585912,585880,581694,585694,582704,584692,585909,587351}'::bigint[]))
9. 32.430 32.430 ↑ 1.0 1 6,486

Index Scan using line_pkey on line line1_ (cost=0.43..7.30 rows=1 width=16) (actual time=0.005..0.005 rows=1 loops=6,486)

  • Index Cond: (id = auditpacka0_.line_id)