explain.depesz.com

PostgreSQL's explain analyze made readable

Result: e11u : exists

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 116.598 11,231.819 ↑ 1.9 13,058 1

Merge Semi Join (cost=45,601.82..126,189.42 rows=25,250 width=47) (actual time=2,329.314..11,231.819 rows=13,058 loops=1)

  • Merge Cond: (auditpacka0_.id = bia.audit_package_item_id)
2. 352.552 10,957.497 ↑ 21.8 13,058 1

Merge Join (cost=45,595.30..109,018.66 rows=284,358 width=55) (actual time=2,106.238..10,957.497 rows=13,058 loops=1)

  • Merge Cond: (billitemsa3_.audit_package_item_id = auditpacka0_.id)
3. 10,085.211 10,085.211 ↑ 28.3 153,187 1

Index Scan using bill_item_audit_audit_package_item_id_ix on bill_item_audit billitemsa3_ (cost=0.43..2,405,615.70 rows=4,342,016 width=8) (actual time=11.093..10,085.211 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: 676604
4. 38.429 519.734 ↓ 2.0 13,057 1

Sort (cost=45,594.86..45,611.16 rows=6,522 width=47) (actual time=506.364..519.734 rows=13,057 loops=1)

  • Sort Key: auditpacka0_.id
  • Sort Method: quicksort Memory: 998kB
5. 17.645 481.305 ↑ 1.0 6,486 1

Merge Join (cost=0.99..45,181.65 rows=6,522 width=47) (actual time=4.070..481.305 rows=6,486 loops=1)

  • Merge Cond: (auditpacka2_.id = auditpacka0_.audit_package_id)
6. 1.554 1.554 ↓ 1.0 202 1

Index Only Scan using audit_package_pkey on audit_package auditpacka2_ (cost=0.14..26.63 rows=201 width=8) (actual time=0.835..1.554 rows=202 loops=1)

  • Heap Fetches: 152
7. 20.539 462.106 ↑ 1.0 6,486 1

Materialize (cost=0.85..51,681.68 rows=6,522 width=47) (actual time=2.481..462.106 rows=6,486 loops=1)

8. 46.310 441.567 ↑ 1.0 6,486 1

Nested Loop (cost=0.85..51,665.38 rows=6,522 width=47) (actual time=2.441..441.567 rows=6,486 loops=1)

9. 168.247 168.247 ↑ 1.0 6,486 1

Index Scan using audit_package_item_audit_package_id_ix on audit_package_item auditpacka0_ (cost=0.42..3,849.56 rows=6,522 width=39) (actual time=1.379..168.247 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[]))
10. 227.010 227.010 ↑ 1.0 1 6,486

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

  • Index Cond: (id = auditpacka0_.line_id)
11. 157.724 157.724 ↑ 32.1 171,839 1

Index Only Scan using bill_item_audit_audit_package_item_id_ix on bill_item_audit bia (cost=0.43..456,694.37 rows=5,523,613 width=8) (actual time=2.914..157.724 rows=171,839 loops=1)

  • Heap Fetches: 13393