explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6oF7

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 6.027 47,654.399 ↑ 1.3 90 1

Subquery Scan on x (cost=251.31..295,630.90 rows=116 width=263) (actual time=936.203..47,654.399 rows=90 loops=1)

2. 43.137 47,648.372 ↑ 1.3 90 1

Hash Left Join (cost=251.31..295,628.87 rows=116 width=263) (actual time=936.104..47,648.372 rows=90 loops=1)

  • Hash Cond: (('AGORA_SKLEP-'::text || ((((ai.plik_importu -> 'Wysylka'::text) -> 'Paczka'::text) -> 0) ->> 'idpaczki'::text)) = (k.nazwa)::text)
3. 0.699 0.699 ↑ 1.3 90 1

Index Scan using "input - typ_szablonu+status" on input ai (cost=0.28..294.57 rows=116 width=1,114) (actual time=0.090..0.699 rows=90 loops=1)

  • Index Cond: ((typ_szablonu = 2) AND (status = ANY ('{9,-10}'::integer[])))
4. 1.844 4.166 ↑ 1.0 2,446 1

Hash (cost=220.46..220.46 rows=2,446 width=231) (actual time=4.166..4.166 rows=2,446 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 687kB
5. 2.322 2.322 ↑ 1.0 2,446 1

Seq Scan on koszyk k (cost=0.00..220.46 rows=2,446 width=231) (actual time=0.012..2.322 rows=2,446 loops=1)

6.          

SubPlan (forHash Left Join)

7. 10.080 47,600.370 ↑ 1.0 1 90

Aggregate (cost=2,543.69..2,543.71 rows=1 width=32) (actual time=528.892..528.893 rows=1 loops=90)

8. 60.840 47,590.290 ↑ 652.5 2 90

Hash Right Join (cost=2,077.49..2,524.12 rows=1,305 width=47) (actual time=526.974..528.781 rows=2 loops=90)

  • Hash Cond: (pd.id_pozycji_zamowienia = kp.id_wfmag)
9. 1,753.470 1,753.470 ↓ 1.0 3,958 90

Seq Scan on powiazania_dokumentow pd (cost=0.00..428.40 rows=3,951 width=15) (actual time=0.027..19.483 rows=3,958 loops=90)

  • Filter: ((nr_wz)::text ~~* 'WAD%'::text)
  • Rows Removed by Filter: 11994
10. 1.080 45,775.980 ↑ 652.5 2 90

Hash (cost=2,061.18..2,061.18 rows=1,305 width=44) (actual time=508.622..508.622 rows=2 loops=90)

  • Buckets: 2048 Batches: 1 Memory Usage: 17kB
11. 127.080 45,774.900 ↑ 652.5 2 90

Hash Right Join (cost=1,148.86..2,061.18 rows=1,305 width=44) (actual time=507.606..508.610 rows=2 loops=90)

  • Hash Cond: (kp.id_koszyk = k_1.id)
  • Join Filter: ((_int.indeks_katalogowy(kp.id_wms_asortyment))::text = (((json_array_elements((((((ai2.plik_importu -> 'Wysylka'::text) -> 'Paczka'::text) -> 0) -> 'PozycjePaczki'::text) -> 'PozycjaPaczki'::text))) ->> 'kodproduktu'::text)))
  • Rows Removed by Join Filter: 8
12. 79.470 79.470 ↓ 1.0 5,374 90

Seq Scan on koszyk_pozycje kp (cost=0.00..154.68 rows=5,268 width=20) (actual time=0.005..0.883 rows=5,374 loops=90)

13. 0.630 45,568.350 ↑ 652.5 2 90

Hash (cost=1,132.55..1,132.55 rows=1,305 width=36) (actual time=506.315..506.315 rows=2 loops=90)

  • Buckets: 2048 Batches: 1 Memory Usage: 17kB
14. 1.108 45,567.720 ↑ 652.5 2 90

Hash Left Join (cost=251.04..1,132.55 rows=1,305 width=36) (actual time=312.934..506.308 rows=2 loops=90)

  • Hash Cond: (('AGORA_SKLEP-'::text || (((((ai2.plik_importu -> 'Wysylka'::text) -> 'Paczka'::text) -> 0) ->> 'idpaczki'::text))) = (k_1.nazwa)::text)
15. 32.940 45,564.390 ↑ 650.0 2 90

Result (cost=0.00..819.71 rows=1,300 width=64) (actual time=312.901..506.271 rows=2 loops=90)

16. 14.040 45,531.450 ↑ 650.0 2 90

ProjectSet (cost=0.00..770.96 rows=1,300 width=1,113) (actual time=312.772..505.905 rows=2 loops=90)

17. 45,517.410 45,517.410 ↑ 13.0 1 90

Seq Scan on input ai2 (cost=0.00..764.20 rows=13 width=1,081) (actual time=312.619..505.749 rows=1 loops=90)

  • Filter: (((((plik_importu -> 'Wysylka'::text) -> 'Paczka'::text) -> 0) ->> 'idpaczki'::text) = ((((ai.plik_importu -> 'Wysylka'::text) -> 'Paczka'::text) -> 0) ->> 'idpaczki'::text))
  • Rows Removed by Filter: 2434
18. 0.981 2.222 ↑ 1.0 2,446 1

Hash (cost=220.46..220.46 rows=2,446 width=25) (actual time=2.222..2.222 rows=2,446 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 176kB
19. 1.241 1.241 ↑ 1.0 2,446 1

Seq Scan on koszyk k_1 (cost=0.00..220.46 rows=2,446 width=25) (actual time=0.019..1.241 rows=2,446 loops=1)