explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hbWX : Evasão - Percentual Matrícula x Cancelamento - Gráfico

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 1,397.049 1,469.480 ↑ 2,052.1 26 1

CTE Scan on evasao eva (cost=16,414.3..19,082 rows=53,354 width=112) (actual time=1,469.412..1,469.48 rows=26 loops=1)

  • Buffers: shared hit=2073, temp read=615 written=614
2.          

CTE evasao

3. 48.567 1,469.334 ↑ 2,052.1 26 1

GroupAggregate (cost=13,613.21..15,213.83 rows=53,354 width=56) (actual time=1,396.951..1,469.334 rows=26 loops=1)

  • Group Key: (to_char(ped.data_pedido, 'YYYY-MM'::text))
  • Buffers: shared hit=2073, temp read=615 written=614
4. 239.567 1,420.767 ↓ 1.0 53,790 1

Sort (cost=13,613.21..13,746.59 rows=53,354 width=48) (actual time=1,394.137..1,420.767 rows=53,790 loops=1)

  • Sort Key: (to_char(ped.data_pedido, 'YYYY-MM'::text))
  • Sort Method: external merge Disk: 2008kB
  • Buffers: shared hit=2073, temp read=615 written=614
5. 203.148 1,181.200 ↓ 1.0 53,790 1

Hash Join (cost=6,490.03..9,424.04 rows=53,354 width=48) (actual time=918.53..1,181.2 rows=53,790 loops=1)

  • Buffers: shared hit=2073, temp read=364 written=362
6. 59.743 59.743 ↑ 1.0 72,836 1

Seq Scan on pagamento pag (cost=0..1,675.15 rows=74,961 width=8) (actual time=0.016..59.743 rows=72,836 loops=1)

  • Filter: (pag.tipo_pagamento = 1)
  • Buffers: shared hit=735
7. 33.572 918.309 ↓ 1.0 53,790 1

Hash (cost=5,689.72..5,689.72 rows=53,354 width=28) (actual time=918.309..918.309 rows=53,790 loops=1)

  • Buffers: shared hit=1338, temp read=364 written=362
8. 108.806 884.737 ↓ 1.0 53,790 1

Hash Join (cost=2,134.49..5,689.72 rows=53,354 width=28) (actual time=417.599..884.737 rows=53,790 loops=1)

  • Buffers: shared hit=1338, temp read=364 written=362
9. 64.990 775.498 ↓ 1.0 53,790 1

Hash Join (cost=2,097.54..5,372.66 rows=53,354 width=44) (actual time=417.153..775.498 rows=53,790 loops=1)

  • Buffers: shared hit=1315, temp read=364 written=362
10. 165.414 710.146 ↓ 1.0 53,790 1

Hash Join (cost=2,076.5..4,931.45 rows=53,354 width=44) (actual time=416.778..710.146 rows=53,790 loops=1)

  • Buffers: shared hit=1309, temp read=364 written=362
11. 66.118 128.170 ↑ 1.0 59,420 1

Hash Join (cost=21.93..1,982.67 rows=59,543 width=32) (actual time=0.028..128.17 rows=59,420 loops=1)

  • Buffers: shared hit=891
12. 62.043 62.043 ↑ 1.0 59,420 1

Seq Scan on pedido ped (cost=0..1,803.2 rows=59,543 width=28) (actual time=0.006..62.043 rows=59,420 loops=1)

  • Filter: ((ped.status)::text = ANY ('{wc-cancelled,wc-completed}'::text[]))
  • Buffers: shared hit=890
13. 0.006 0.009 ↑ 265.0 2 1

Hash (cost=15.3..15.3 rows=530 width=4) (actual time=0.008..0.009 rows=2 loops=1)

  • Buffers: shared hit=1
14. 0.003 0.003 ↑ 265.0 2 1

Seq Scan on instituicao inst (cost=0..15.3 rows=530 width=4) (actual time=0.003..0.003 rows=2 loops=1)

  • Buffers: shared hit=1
15. 263.941 416.562 ↓ 1.0 65,542 1

Hash (cost=1,072.63..1,072.63 rows=65,463 width=16) (actual time=416.562..416.562 rows=65,542 loops=1)

  • Buffers: shared hit=418, temp written=143
16. 152.621 152.621 ↓ 1.0 65,542 1

Seq Scan on pedido_oferta pof (cost=0..1,072.63 rows=65,463 width=16) (actual time=0.007..152.621 rows=65,542 loops=1)

  • Buffers: shared hit=418
17. 0.191 0.362 ↑ 1.1 507 1

Hash (cost=11.47..11.47 rows=547 width=16) (actual time=0.362..0.362 rows=507 loops=1)

  • Buffers: shared hit=6
18. 0.171 0.171 ↑ 1.1 507 1

Seq Scan on oferta ofe (cost=0..11.47 rows=547 width=16) (actual time=0.005..0.171 rows=507 loops=1)

  • Buffers: shared hit=6
19. 0.203 0.433 ↑ 1.0 558 1

Hash (cost=28.58..28.58 rows=558 width=8) (actual time=0.433..0.433 rows=558 loops=1)

  • Buffers: shared hit=23
20. 0.230 0.230 ↑ 1.0 558 1

Seq Scan on curso curs (cost=0..28.58 rows=558 width=8) (actual time=0.007..0.23 rows=558 loops=1)

  • Buffers: shared hit=23
21.          

Initplan (for CTE Scan)

22. 0.017 72.431 ↑ 1.0 1 1

Aggregate (cost=1,200.47..1,200.48 rows=1 width=32) (actual time=72.431..72.431 rows=1 loops=1)

23. 72.414 72.414 ↑ 2,052.1 26 1

CTE Scan on evasao evasao (cost=0..1,067.08 rows=53,354 width=8) (actual time=0.001..72.414 rows=26 loops=1)

Planning time : 2.956 ms
Execution time : 1,470.041 ms