explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qevN

Settings

Optimization(s) for this plan:

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

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

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

CTE t

3. 30.636 190.680 ↑ 1.0 91,559 1

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

4. 73.231 160.044 ↑ 1.0 91,559 1

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

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

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

6. 3.505 81.253 ↑ 1.0 91,559 1

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

7. 45.506 73.930 ↑ 1.0 91,557 1

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

  • Hash Cond: (prevendas.codigo = pf.codprevenda)
8. 5.335 5.335 ↑ 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.335 rows=91,560 loops=1)

9. 14.070 23.089 ↑ 1.0 91,557 1

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

  • Buckets: 131072 Batches: 1 Memory Usage: 4959kB
10. 9.019 9.019 ↑ 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.002..9.019 rows=91,557 loops=1)

11. 2.436 3.818 ↑ 925.0 2 1

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

  • Hash Cond: (saidasnf.codigo = sf.codsaidasnf)
12. 1.375 1.375 ↑ 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.375 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)