explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JPCc

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 82,394.090 ↑ 15,145.4 21 1

Append (cost=1,190,561.13..2,360,679.23 rows=318,053 width=22) (actual time=82,393.753..82,394.090 rows=21 loops=1)

2. 0.001 42,058.319 ↓ 0.0 0 1

Unique (cost=1,190,561.13..1,193,090.05 rows=168,595 width=22) (actual time=42,058.319..42,058.319 rows=0 loops=1)

3. 0.000 42,058.318 ↓ 0.0 0 1

Sort (cost=1,190,561.13..1,190,982.62 rows=168,595 width=22) (actual time=42,058.318..42,058.318 rows=0 loops=1)

  • Sort Key: i.ncm, i.uf_origem, i.uf_destino, rf.aliq_padrao, i.cst_suffix
  • Sort Method: quicksort Memory: 25kB
4. 10.256 42,058.464 ↓ 0.0 0 1

Gather (cost=1,128,340.49..1,172,466.38 rows=168,595 width=22) (actual time=42,058.305..42,058.464 rows=0 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
5. 0.285 42,048.208 ↓ 0.0 0 3 / 3

Parallel Hash Join (cost=1,127,340.49..1,154,606.88 rows=70,248 width=22) (actual time=42,048.206..42,048.208 rows=0 loops=3)

  • Hash Cond: ((rf.id_ncm = ncm.id_ncm) AND (rf.uf_origem = i.uf_origem) AND (rf.uf_destino = i.uf_destino))
6. 0.000 0.000 ↓ 0.0 0 / 3

Parallel Seq Scan on regra_fiscal rf (cost=0.00..10,066.97 rows=333,806 width=17) (never executed)

  • Filter: ((aliq_padrao IS NOT NULL) AND (tp_regra_fiscal = 'P'::bpchar))
7. 0.075 42,047.923 ↓ 0.0 0 3 / 3

Parallel Hash (cost=1,125,439.60..1,125,439.60 rows=81,365 width=19) (actual time=42,047.923..42,047.923 rows=0 loops=3)

  • Buckets: 65536 Batches: 4 Memory Usage: 0kB
8. 0.001 42,047.848 ↓ 0.0 0 3 / 3

Hash Join (cost=328.55..1,125,439.60 rows=81,365 width=19) (actual time=42,047.848..42,047.848 rows=0 loops=3)

  • Hash Cond: ((i.ncm)::text = (ncm.ncm)::text)
9. 42,047.847 42,047.847 ↓ 0.0 0 3 / 3

Parallel Seq Scan on item i (cost=0.00..1,123,768.84 rows=84,570 width=15) (actual time=42,047.846..42,047.847 rows=0 loops=3)

  • Filter: (((ncm)::text <> ''::text) AND (id_subvencao = 396) AND (vl_subvencao = '0'::numeric) AND ((cst_suffix)::text = ANY ('{20,40,50,51}'::text[])))
  • Rows Removed by Filter: 9191371
10. 0.000 0.000 ↓ 0.0 0 / 3

Hash (cost=202.69..202.69 rows=10,069 width=12) (never executed)

11. 0.000 0.000 ↓ 0.0 0 / 3

Seq Scan on ncm (cost=0.00..202.69 rows=10,069 width=12) (never executed)

12. 0.278 40,335.766 ↑ 7,117.0 21 1

Unique (cost=1,160,576.51..1,162,818.38 rows=149,458 width=22) (actual time=40,335.431..40,335.766 rows=21 loops=1)

13. 0.000 40,335.488 ↑ 110.0 1,359 1

Sort (cost=1,160,576.51..1,160,950.16 rows=149,458 width=22) (actual time=40,335.429..40,335.488 rows=1,359 loops=1)

  • Sort Key: i_1.ncm, i_1.uf_origem, i_1.uf_destino, rf_1.aliq_padrao, i_1.cst_suffix
  • Sort Method: quicksort Memory: 155kB
14. 33.678 40,360.390 ↑ 110.0 1,359 1

Gather (cost=1,128,309.65..1,144,665.06 rows=149,458 width=22) (actual time=40,334.233..40,360.390 rows=1,359 loops=1)

  • Workers Planned: 2
  • Workers Launched: 1
15. 0.239 40,326.712 ↑ 91.6 680 2 / 2

Merge Join (cost=1,127,309.65..1,128,719.26 rows=62,274 width=22) (actual time=40,326.427..40,326.712 rows=680 loops=2)

  • Merge Cond: ((i_1.uf_origem = rf_1.uf_origem) AND (i_1.uf_destino = rf_1.uf_destino))
16. 0.300 40,326.208 ↑ 65.0 659 2 / 2

Sort (cost=1,127,062.47..1,127,169.51 rows=42,814 width=15) (actual time=40,326.180..40,326.208 rows=659 loops=2)

  • Sort Key: i_1.uf_origem, i_1.uf_destino
  • Sort Method: quicksort Memory: 57kB
  • Worker 0: Sort Method: quicksort Memory: 54kB
17. 40,325.908 40,325.908 ↑ 65.0 659 2 / 2

Parallel Seq Scan on item i_1 (cost=0.00..1,123,768.84 rows=42,814 width=15) (actual time=20,110.837..40,325.908 rows=659 loops=2)

  • Filter: ((((ncm)::text = ''::text) OR (ncm IS NULL)) AND (id_subvencao = 396) AND (vl_subvencao = '0'::numeric) AND ((cst_suffix)::text = ANY ('{20,40,50,51}'::text[])))
  • Rows Removed by Filter: 13786398
18. 0.142 0.265 ↓ 6.9 926 2 / 2

Sort (cost=246.61..246.94 rows=134 width=13) (actual time=0.226..0.265 rows=926 loops=2)

  • Sort Key: rf_1.uf_origem, rf_1.uf_destino
  • Sort Method: quicksort Memory: 39kB
  • Worker 0: Sort Method: quicksort Memory: 39kB
19. 0.123 0.123 ↓ 2.4 318 2 / 2

Index Scan using regra_fiscal_ix_regra_fiscal_1 on regra_fiscal rf_1 (cost=0.42..241.87 rows=134 width=13) (actual time=0.028..0.123 rows=318 loops=2)

  • Index Cond: (tp_regra_fiscal = 'T'::bpchar)
  • Filter: (aliq_padrao IS NOT NULL)
Planning time : 1.152 ms
Execution time : 82,420.158 ms