explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xo6u

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

Nested Loop (cost=196.64..4,218,429.19 rows=1 width=354) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop (cost=196.22..4,218,421.95 rows=1 width=317) (actual rows= loops=)

  • Join Filter: ((SubPlan 2) = contracthistory.nbr)
3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=195.79..4,218,392.74 rows=1 width=307) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Hash Join (cost=195.37..4,175,972.19 rows=2,537 width=288) (actual rows= loops=)

  • Hash Cond: ((reporting.invoicenbr)::text = (invoice.invoicenbr)::text)
5. 0.000 0.000 ↓ 0.0

Seq Scan on reporting (cost=0.00..3,859,178.24 rows=84,419,524 width=258) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Hash (cost=192.83..192.83 rows=203 width=43) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Index Scan using fki_invoice_invoicedate_fkey on invoice (cost=0.43..192.83 rows=203 width=43) (actual rows= loops=)

  • Index Cond: ((invoicedate >= '2014-07-01'::date) AND (invoicedate < '2014-08-01'::date))
  • Filter: (((invoicenaturecode)::text !~~ 'INV-INSTAL%'::text) AND ((invoicenaturecode)::text !~~ 'INV-TALEXUS'::text))
8. 0.000 0.000 ↓ 0.0

Index Scan using fki_contractdelivery_contractnbr_fkey on contractdelivery (cost=0.42..16.71 rows=1 width=31) (actual rows= loops=)

  • Index Cond: ((contractnbr)::text = (invoice.contractnbr)::text)
  • Filter: ((SubPlan 1) = contractdeliveryid)
9.          

SubPlan (for Index Scan)

10. 0.000 0.000 ↓ 0.0

Limit (cost=8.48..8.48 rows=1 width=20) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Sort (cost=8.48..8.48 rows=1 width=20) (actual rows= loops=)

  • Sort Key: (abs(date_part('day'::text, ((invoice.periodstart)::timestamp without time zone - (cd2.fromdate)::timestamp without time zone)))), (abs(date_part('day'::text, ((invoice.periodend)::timestamp without time zone - (cd2.todate)::timestamp without time zone))))
12. 0.000 0.000 ↓ 0.0

Index Scan using fki_contractdelivery_contractnbr_fkey on contractdelivery cd2 (cost=0.42..8.47 rows=1 width=20) (actual rows= loops=)

  • Index Cond: ((contractnbr)::text = (contractdelivery.contractnbr)::text)
13. 0.000 0.000 ↓ 0.0

Index Scan using contracthistory_pkey on contracthistory (cost=0.42..8.73 rows=2 width=32) (actual rows= loops=)

  • Index Cond: ((contractnbr)::text = (contractdelivery.contractnbr)::text)
14.          

SubPlan (for Nested Loop)

15. 0.000 0.000 ↓ 0.0

Limit (cost=10.23..10.23 rows=1 width=8) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Sort (cost=10.23..10.23 rows=2 width=8) (actual rows= loops=)

  • Sort Key: ((contracthistory_1.enddate - contracthistory_1.startdate)) DESC
17. 0.000 0.000 ↓ 0.0

Index Scan using contracthistory_pkey on contracthistory contracthistory_1 (cost=0.42..10.22 rows=2 width=8) (actual rows= loops=)

  • Index Cond: ((contractnbr)::text = (invoice.contractnbr)::text)
18. 0.000 0.000 ↓ 0.0

Index Scan using fki_dpconfiguration_ean_fkey on dpconfiguration (cost=0.42..7.23 rows=1 width=56) (actual rows= loops=)

  • Index Cond: ((ean)::text = (contractdelivery.ean)::text)