explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NN8T

Settings
# exclusive inclusive rows x rows loops node
1. 33.148 79,903.569 ↓ 4,120.0 4,120 1

GroupAggregate (cost=562,910.99..562,911.02 rows=1 width=55) (actual time=79,868.755..79,903.569 rows=4,120 loops=1)

  • Group Key: sm.cd_empresa, sm.dt_data, sm.nr_hora, sm.nr_pdv, sm.cd_operador
2. 164.916 79,870.421 ↓ 52,996.0 52,996 1

Sort (cost=562,910.99..562,911.00 rows=1 width=26) (actual time=79,868.738..79,870.421 rows=52,996 loops=1)

  • Sort Key: sm.cd_empresa, sm.dt_data, sm.nr_hora, sm.nr_pdv, sm.cd_operador
  • Sort Method: quicksort Memory: 5677kB
3. 198.152 79,705.505 ↓ 52,996.0 52,996 1

Gather (cost=1,001.13..562,910.98 rows=1 width=26) (actual time=87.234..79,705.505 rows=52,996 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
4. 78,025.441 79,507.353 ↓ 26,498.0 26,498 2

Nested Loop (cost=1.13..561,910.88 rows=1 width=26) (actual time=108.979..79,507.353 rows=26,498 loops=2)

5. 1,457.611 1,481.733 ↓ 46.5 434,856 2

Nested Loop (cost=0.56..494,756.75 rows=9,354 width=43) (actual time=7.249..1,481.733 rows=434,856 loops=2)

6. 23.856 23.856 ↑ 1.1 5,097 2

Parallel Seq Scan on tb_teste sm (cost=0.00..3,769.95 rows=5,746 width=23) (actual time=4.494..23.856 rows=5,097 loops=2)

  • Filter: (dt_data >= '2019-07-01'::date)
  • Rows Removed by Filter: 95404
7. 0.266 0.266 ↓ 85.0 85 10,193

Index Scan using pdvcup00_pkey on pdvcup00 p0 (cost=0.56..85.44 rows=1 width=25) (actual time=0.103..0.266 rows=85 loops=10,193)

  • Index Cond: ((emp = sm.cd_empresa) AND (dta = sm.dt_data) AND (pdv = sm.nr_pdv) AND (num > '0'::numeric))
  • Filter: (sm.cd_operador = ope)
  • Rows Removed by Filter: 95
8. 0.179 0.179 ↓ 0.0 0 869,711

Index Scan using pdvcup01_pkey on pdvcup01 p1 (cost=0.57..7.17 rows=1 width=23) (actual time=0.175..0.179 rows=0 loops=869,711)

  • Index Cond: ((emp = p0.emp) AND (dta = p0.dta) AND (pdv = p0.pdv) AND (num = p0.num) AND (bar > '0'::numeric))
  • Filter: (vad <> '0'::numeric)
  • Rows Removed by Filter: 6
Planning time : 1.798 ms
Execution time : 79,904.287 ms