explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KBGO

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.010 389.204 ↑ 1.0 10 1

Limit (cost=0.28..303,111.73 rows=10 width=83) (actual time=39.520..389.204 rows=10 loops=1)

2. 1.051 389.194 ↑ 100.0 10 1

Nested Loop (cost=0.28..30,311,145.05 rows=1,000 width=83) (actual time=39.519..389.194 rows=10 loops=1)

  • Join Filter: (md.internal_id = pmd.internal_id)
  • Rows Removed by Join Filter: 1722
3. 0.033 0.033 ↑ 200.0 10 1

Index Scan using miesto_dodavky_external_id_key on miesto_dodavky md (cost=0.28..251.37 rows=2,000 width=74) (actual time=0.006..0.033 rows=10 loops=1)

4. 0.130 0.350 ↑ 5.8 173 10

Materialize (cost=0.00..69.00 rows=1,000 width=23) (actual time=0.002..0.035 rows=173 loops=10)

5. 0.220 0.220 ↑ 1.0 1,000 1

Seq Scan on priradenie_miesta_dodavky pmd (cost=0.00..64.00 rows=1,000 width=23) (actual time=0.011..0.220 rows=1,000 loops=1)

  • Filter: ((eic = 'o1'::bpchar) AND ("overlaps"((platnost_od)::timestamp with time zone, (platnost_do)::timestamp with time zone, '2019-03-01 00:00:00+01'::timestamp with time zone, '2019-03-31 00:00:00+01'::timestamp with time zone) OR ((platnost_od <= '2019-03-01'::date) AND (platnost_do IS NULL))))
6.          

SubPlan (forNested Loop)

7. 5.740 387.760 ↑ 1.0 1 10

Aggregate (cost=30,280.83..30,280.84 rows=1 width=32) (actual time=38.776..38.776 rows=1 loops=10)

8. 1.080 382.020 ↑ 1.0 6 10

Subquery Scan on _pocitadlo (cost=30,280.72..30,280.80 rows=6 width=28) (actual time=38.116..38.202 rows=6 loops=10)

9. 0.910 380.940 ↑ 1.0 6 10

Sort (cost=30,280.72..30,280.74 rows=6 width=40) (actual time=38.093..38.094 rows=6 loops=10)

  • Sort Key: p.kennziff
  • Sort Method: quicksort Memory: 1033kB
10. 1.020 380.030 ↑ 1.0 6 10

Nested Loop (cost=0.56..30,280.64 rows=6 width=40) (actual time=6.214..38.003 rows=6 loops=10)

11. 8.590 15.230 ↑ 1.0 6 10

Nested Loop (cost=0.28..397.30 rows=6 width=8) (actual time=0.148..1.523 rows=6 loops=10)

  • Join Filter: ((om.id = pp.odberne_miesto_spotreba_id) OR (om.id = pp.odberne_miesto_vyroba_id))
  • Rows Removed by Join Filter: 11994
12. 0.110 0.110 ↑ 1.0 1 10

Index Scan using odberne_miesto_internal_id_key on odberne_miesto om (cost=0.28..8.29 rows=1 width=8) (actual time=0.010..0.011 rows=1 loops=10)

  • Index Cond: (internal_id = md.internal_id)
13. 6.530 6.530 ↑ 1.0 12,000 10

Seq Scan on priradenie_pocitadla pp (cost=0.00..209.00 rows=12,000 width=24) (actual time=0.004..0.653 rows=12,000 loops=10)

14. 0.180 0.180 ↑ 1.0 1 60

Index Scan using pocitadlo_pkey on pocitadlo p (cost=0.29..0.35 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=60)

  • Index Cond: (id = pp.pocitadlo_id)
15.          

SubPlan (forNested Loop)

16. 267.720 363.600 ↑ 1.0 1 60

Aggregate (cost=4,980.20..4,980.21 rows=1 width=32) (actual time=6.060..6.060 rows=1 loops=60)

17. 28.260 95.880 ↓ 2.4 2,972 60

Subquery Scan on _odpocty (cost=4,958.65..4,974.04 rows=1,231 width=40) (actual time=1.016..1.598 rows=2,972 loops=60)

18. 24.060 67.620 ↓ 2.4 2,972 60

Sort (cost=4,958.65..4,961.73 rows=1,231 width=24) (actual time=1.014..1.127 rows=2,972 loops=60)

  • Sort Key: op.cas_odpoctu
  • Sort Method: quicksort Memory: 329kB
19. 12.540 43.560 ↓ 2.4 2,972 60

Nested Loop (cost=43.70..4,895.47 rows=1,231 width=24) (actual time=0.192..0.726 rows=2,972 loops=60)

20. 0.060 0.780 ↑ 1.0 1 60

Nested Loop (cost=0.56..16.61 rows=1 width=16) (actual time=0.012..0.013 rows=1 loops=60)

21. 0.120 0.120 ↑ 1.0 1 60

Index Only Scan using pocitadlo_pkey on pocitadlo p_inner (cost=0.29..8.30 rows=1 width=8) (actual time=0.001..0.002 rows=1 loops=60)

  • Index Cond: (id = p.id)
  • Heap Fetches: 60
22. 0.600 0.600 ↑ 1.0 1 60

Index Scan using priradenie_pocitadla_exclude_overlaps on priradenie_pocitadla pp_inner (cost=0.28..8.29 rows=1 width=16) (actual time=0.010..0.010 rows=1 loops=60)

  • Index Cond: (pocitadlo_id = p.id)
23. 20.940 30.240 ↓ 7.2 2,972 60

Bitmap Heap Scan on odpocet_profil op (cost=43.14..4,874.71 rows=415 width=24) (actual time=0.178..0.504 rows=2,972 loops=60)

  • Recheck Cond: ((pocitadlo_id = p.id) AND (cas_odpoctu >= pp_inner.platnost_od) AND (cas_odpoctu >= '2019-03-01 00:00:00+01'::timestamp with time zone) AND (cas_odpoctu < '2019-04-01 00:00:00+02'::timestamp with time zone))
  • Filter: ((cas_odpoctu < pp_inner.platnost_do) OR (pp_inner.platnost_do IS NULL))
  • Heap Blocks: exact=1852
24. 9.300 9.300 ↓ 2.9 3,570 60

Bitmap Index Scan on odpocet_profil_pocitadlo_id_cas_odpoctu_idx (cost=0.00..43.04 rows=1,231 width=0) (actual time=0.155..0.155 rows=3,570 loops=60)

  • Index Cond: ((pocitadlo_id = p.id) AND (cas_odpoctu >= pp_inner.platnost_od) AND (cas_odpoctu >= '2019-03-01 00:00:00+01'::timestamp with time zone) AND (cas_odpoctu < '2019-04-01 00:00:00+02'::timestamp with time zone))