explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CNsS

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

Nested Loop (cost=19,567.64..2,008,969.79 rows=1 width=354) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop (cost=19,567.22..2,008,962.55 rows=1 width=317) (actual rows= loops=)

  • Join Filter: ((contractdelivery.contractnbr)::text = (contracthistory.contractnbr)::text)
3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=19,556.56..2,008,944.03 rows=1 width=307) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.86..3,587.14 rows=1 width=62) (actual rows= loops=)

5. 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))
6. 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)
7.          

SubPlan (for Index Scan)

8. 0.000 0.000 ↓ 0.0

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

9. 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))))
10. 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)
11. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on reporting (cost=19,555.71..1,996,194.01 rows=916,287 width=258) (actual rows= loops=)

  • Recheck Cond: ((invoicenbr)::text = (invoice.invoicenbr)::text)
12. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_reporting_invoicenbr (cost=0.00..19,326.63 rows=916,287 width=0) (actual rows= loops=)

  • Index Cond: ((invoicenbr)::text = (invoice.invoicenbr)::text)
13. 0.000 0.000 ↓ 0.0

Index Scan using contracthistory_pkey on contracthistory (cost=10.65..18.51 rows=1 width=32) (actual rows= loops=)

  • Index Cond: (((contractnbr)::text = (invoice.contractnbr)::text) AND (nbr = (SubPlan 2)))
14.          

SubPlan (for Index Scan)

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)