explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jVZr : Optimization for: plan #Cvo1

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 228.027 228.027 ↓ 8.4 3,937 1

CTE Scan on t (cost=19,030.11..21,131.77 rows=467 width=40) (actual time=157.927..228.027 rows=3,937 loops=1)

  • Filter: (rn = 1)
  • Rows Removed by Filter: 87622
2.          

CTE t

3. 32.425 200.123 ↑ 1.0 91,559 1

WindowAgg (cost=17,161.97..19,030.11 rows=93,407 width=29) (actual time=157.920..200.123 rows=91,559 loops=1)

4. 75.754 167.698 ↑ 1.0 91,559 1

Sort (cost=17,161.97..17,395.49 rows=93,407 width=29) (actual time=157.907..167.698 rows=91,559 loops=1)

  • Sort Key: prevendas.codcliente, pf.datahora DESC
  • Sort Method: quicksort Memory: 10226kB
5. 5.463 91.944 ↑ 1.0 91,559 1

Result (cost=2,644.03..9,450.64 rows=93,407 width=29) (actual time=26.872..91.944 rows=91,559 loops=1)

6. 3.570 86.481 ↑ 1.0 91,559 1

Append (cost=2,644.03..9,450.64 rows=93,407 width=29) (actual time=26.872..86.481 rows=91,559 loops=1)

7. 47.808 79.412 ↑ 1.0 91,557 1

Hash Join (cost=2,644.03..7,198.55 rows=91,557 width=21) (actual time=26.871..79.412 rows=91,557 loops=1)

  • Hash Cond: (prevendas.codigo = pf.codprevenda)
8. 5.386 5.386 ↑ 1.0 91,560 1

Seq Scan on prevendas (cost=0.00..3,295.60 rows=91,560 width=13) (actual time=0.003..5.386 rows=91,560 loops=1)

9. 17.228 26.218 ↑ 1.0 91,557 1

Hash (cost=1,499.57..1,499.57 rows=91,557 width=12) (actual time=26.218..26.218 rows=91,557 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 4959kB
10. 8.990 8.990 ↑ 1.0 91,557 1

Seq Scan on prevendas_faturamento pf (cost=0.00..1,499.57 rows=91,557 width=12) (actual time=0.005..8.990 rows=91,557 loops=1)

11. 2.194 3.499 ↑ 925.0 2 1

Hash Join (cost=51.63..1,318.02 rows=1,850 width=22) (actual time=0.118..3.499 rows=2 loops=1)

  • Hash Cond: (saidasnf.codigo = sf.codsaidasnf)
12. 1.298 1.298 ↑ 1.0 22,247 1

Seq Scan on saidasnf (cost=0.00..1,164.47 rows=22,247 width=14) (actual time=0.002..1.298 rows=22,247 loops=1)

13. 0.004 0.007 ↑ 925.0 2 1

Hash (cost=28.50..28.50 rows=1,850 width=12) (actual time=0.007..0.007 rows=2 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 17kB
14. 0.003 0.003 ↑ 925.0 2 1

Seq Scan on saidasnf_faturamento sf (cost=0.00..28.50 rows=1,850 width=12) (actual time=0.003..0.003 rows=2 loops=1)