explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yK2P

Settings
# exclusive inclusive rows x rows loops node
1. 5.604 108,268.910 ↓ 1,392.0 1,392 1

Subquery Scan on t (cost=79,874.41..79,874.48 rows=1 width=190) (actual time=108,263.366..108,268.910 rows=1,392 loops=1)

2. 3.777 108,263.306 ↓ 1,392.0 1,392 1

Sort (cost=79,874.41..79,874.41 rows=1 width=68) (actual time=108,263.231..108,263.306 rows=1,392 loops=1)

  • Sort Key: (min(variazioni_prezzi_vendita.data_variazione))
  • Sort Method: quicksort Memory: 244kB
3. 63,867.048 108,259.529 ↓ 1,392.0 1,392 1

Nested Loop (cost=6,357.62..79,874.40 rows=1 width=68) (actual time=832.049..108,259.529 rows=1,392 loops=1)

  • Join Filter: (variazioni_prezzi_vendita.id_articolo = vpv.id_articolo)
4. 55.082 640.529 ↓ 3.8 1,392 1

Merge Join (cost=6,357.62..47,570.20 rows=365 width=69) (actual time=383.913..640.529 rows=1,392 loops=1)

  • Merge Cond: (variazioni_prezzi_vendita.id_articolo = ap.id_articolo)
5. 270.007 556.342 ↓ 1.3 388,806 1

GroupAggregate (cost=0.00..37,370.16 rows=306,916 width=20) (actual time=0.011..556.342 rows=388,806 loops=1)

6. 286.335 286.335 ↑ 1.0 577,644 1

Index Scan using relationship_22_fk on variazioni_prezzi_vendita (cost=0.00..26,221.47 rows=577,766 width=20) (actual time=0.006..286.335 rows=577,644 loops=1)

7. 2.688 29.105 ↓ 3.0 1,392 1

Sort (cost=6,357.62..6,358.78 rows=463 width=39) (actual time=28.057..29.105 rows=1,392 loops=1)

  • Sort Key: ap.id_articolo
  • Sort Method: quicksort Memory: 166kB
8. 25.337 26.417 ↓ 3.0 1,392 1

Bitmap Heap Scan on articoli_presenti ap (cost=141.79..6,337.12 rows=463 width=39) (actual time=1.524..26.417 rows=1,392 loops=1)

  • Recheck Cond: (id_cliente = 3558::numeric)
  • Filter: (esistenza > 0::numeric)
9. 1.080 1.080 ↑ 1.0 7,064 1

Bitmap Index Scan on relationship_15_fk (cost=0.00..141.67 rows=7,117 width=0) (actual time=1.080..1.080 rows=7,064 loops=1)

  • Index Cond: (id_cliente = 3558::numeric)
10. 25.056 25.056 ↓ 1.9 23 1,392

Index Scan using vpv_tst on variazioni_prezzi_vendita vpv (cost=0.00..8.03 rows=12 width=31) (actual time=0.012..0.018 rows=23 loops=1,392)

  • Index Cond: (vpv.tst = (max(variazioni_prezzi_vendita.tst)))
11.          

SubPlan (for Nested Loop)

12. 43,072.945 43,726.896 ↑ 1.1 363,290 1,392

Materialize (cost=0.00..57,655.01 rows=383,808 width=8) (actual time=0.028..31.413 rows=363,290 loops=1,392)

13. 202.846 653.951 ↓ 1.0 383,991 1

Merge Join (cost=0.00..54,235.97 rows=383,808 width=8) (actual time=0.131..653.951 rows=383,991 loops=1)

  • Merge Cond: (carichi_merce.id_articolo = ap.id_articolo)
14. 189.366 311.326 ↑ 1.0 388,805 1

GroupAggregate (cost=0.00..29,544.45 rows=388,929 width=12) (actual time=0.064..311.326 rows=388,805 loops=1)

  • Filter: ((min(carichi_merce.data_carico) >= '2016-01-19'::date) AND (min(carichi_merce.data_carico) <= '2030-12-31'::date))
15. 121.960 121.960 ↑ 1.0 388,806 1

Index Scan using carichim_idarticolo on carichi_merce (cost=0.00..16,904.26 rows=388,929 width=12) (actual time=0.056..121.960 rows=388,806 loops=1)

16. 139.779 139.779 ↓ 1.0 383,991 1

Index Scan using pk_articoli_promo on articoli_promo ap (cost=0.00..15,032.19 rows=383,805 width=8) (actual time=0.062..139.779 rows=383,991 loops=1)

  • Filter: ap.promozione