explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6xYQ : Optimization for: Atlas; plan #jqSb

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 1,249.141 125,749.769 ↓ 32,472.5 64,945 1

Sort (cost=467,572.52..467,572.53 rows=2 width=2,648) (actual time=125,374.495..125,749.769 rows=64,945 loops=1)

  • Sort Key: a.datapiramide, a.nrdoc, a.nrguia, a.valor
  • Sort Method: external merge Disk: 36,440kB
2. 161.730 124,500.628 ↓ 32,472.5 64,945 1

Subquery Scan on a (cost=5,961.96..467,572.51 rows=2 width=2,648) (actual time=6,326.310..124,500.628 rows=64,945 loops=1)

3. 150.050 124,338.898 ↓ 32,472.5 64,945 1

Append (cost=5,961.96..467,572.49 rows=2 width=2,648) (actual time=6,326.306..124,338.898 rows=64,945 loops=1)

4. 165.174 123,309.237 ↓ 64,945.0 64,945 1

Subquery Scan on *SELECT* 1 (cost=5,961.96..453,759.96 rows=1 width=890) (actual time=6,326.303..123,309.237 rows=64,945 loops=1)

5. 297.968 123,144.063 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,961.96..453,759.95 rows=1 width=886) (actual time=6,326.299..123,144.063 rows=64,945 loops=1)

6. 293.295 122,521.370 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,961.68..453,758.28 rows=1 width=768) (actual time=6,326.265..122,521.370 rows=64,945 loops=1)

7. 308.536 121,903.350 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,961.40..453,756.61 rows=1 width=708) (actual time=6,326.223..121,903.350 rows=64,945 loops=1)

8. 300.366 121,075.254 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,960.98..453,754.35 rows=1 width=667) (actual time=6,326.164..121,075.254 rows=64,945 loops=1)

9. 280.173 120,644.998 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,960.85..453,754.17 rows=1 width=555) (actual time=6,326.127..120,644.998 rows=64,945 loops=1)

10. 255.436 120,105.045 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,960.58..453,753.15 rows=1 width=556) (actual time=6,326.093..120,105.045 rows=64,945 loops=1)

11. 245.312 119,654.774 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,960.44..453,752.93 rows=1 width=444) (actual time=6,326.041..119,654.774 rows=64,945 loops=1)

12. 314.235 119,214.627 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,960.31..453,752.70 rows=1 width=332) (actual time=6,326.010..119,214.627 rows=64,945 loops=1)

13. 278.557 118,640.612 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,960.17..453,751.73 rows=1 width=331) (actual time=6,325.983..118,640.612 rows=64,945 loops=1)

14. 279.483 117,842.495 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,959.88..453,749.59 rows=1 width=332) (actual time=6,325.929..117,842.495 rows=64,945 loops=1)

15. 261.129 114,835.322 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,959.45..453,747.31 rows=1 width=296) (actual time=6,325.843..114,835.322 rows=64,945 loops=1)

16. 296.862 114,314.413 ↓ 64,945.0 64,945 1

Nested Loop Left Join (cost=5,959.31..453,747.15 rows=1 width=283) (actual time=6,325.814..114,314.413 rows=64,945 loops=1)

17. 290.633 113,562.936 ↓ 64,945.0 64,945 1

Nested Loop (cost=5,959.03..453,745.08 rows=1 width=210) (actual time=6,325.753..113,562.936 rows=64,945 loops=1)

18. 0.000 97,945.283 ↓ 64,945.0 64,945 1

Gather (cost=5,958.47..453,742.23 rows=1 width=173) (actual time=6,325.630..97,945.283 rows=64,945 loops=1)

  • Workers Planned: 6
  • Workers Launched: 6
19. 49.245 104,234.899 ↓ 9,278.0 9,278 7 / 7

Hash Join (cost=4,958.47..452,742.13 rows=1 width=173) (actual time=6,316.293..104,234.899 rows=9,278 loops=7)

  • Hash Cond: ((mic.id_movitem_financeiro)::text = (mif.id)::text)
20. 103,851.928 103,851.928 ↓ 2.8 23,304 7 / 7

Parallel Seq Scan on movitem_composicao mic (cost=0.00..447,752.03 rows=8,435 width=144) (actual time=5,982.320..103,851.928 rows=23,304 loops=7)

  • Filter: ((date(dt_pir) >= '2020-05-01'::date) AND (date(dt_pir) <= '2020-05-31'::date))
  • Rows Removed by Filter: 1,422,740
21. 92.361 333.726 ↓ 2,599.7 64,992 7 / 7

Hash (cost=4,958.15..4,958.15 rows=25 width=53) (actual time=333.725..333.726 rows=64,992 loops=7)

  • Buckets: 65,536 (originally 1024) Batches: 1 (originally 1) Memory Usage: 6,098kB
22. 147.179 241.365 ↓ 2,599.7 64,992 7 / 7

Nested Loop (cost=0.99..4,958.15 rows=25 width=53) (actual time=0.097..241.365 rows=64,992 loops=7)

23. 0.058 0.058 ↑ 1.0 1 7 / 7

Index Scan using idx_tabdocfin_nr_doc on tabdocfin f (cost=0.42..8.45 rows=1 width=35) (actual time=0.055..0.058 rows=1 loops=7)

  • Index Cond: (((id_emp)::text = '1'::text) AND ((nr_doc)::text = '8814904'::text))
24. 94.128 94.128 ↓ 36.5 64,992 7 / 7

Index Scan using movitem_financeiro_docfin_idx on movitem_financeiro mif (cost=0.56..4,931.92 rows=1,779 width=38) (actual time=0.030..94.128 rows=64,992 loops=7)

  • Index Cond: ((id_docfin)::text = (f.id)::text)
25. 15,327.020 15,327.020 ↑ 1.0 1 64,945

Index Scan using movitem_pk on movitem mi (cost=0.56..2.84 rows=1 width=69) (actual time=0.236..0.236 rows=1 loops=64,945)

  • Index Cond: ((id)::text = (mif.id_movitem)::text)
26. 454.615 454.615 ↑ 1.0 1 64,945

Index Scan using tabprestador_pk on tabprestador p (cost=0.29..2.08 rows=1 width=86) (actual time=0.007..0.007 rows=1 loops=64,945)

  • Index Cond: ((mi.id_prest)::text = (id)::text)
27. 259.780 259.780 ↑ 1.0 1 64,945

Index Scan using tabprest_classe_pk on tabprest_classe pc (cost=0.14..0.16 rows=1 width=33) (actual time=0.004..0.004 rows=1 loops=64,945)

  • Index Cond: ((p.id_classe)::text = (id)::text)
28. 2,727.690 2,727.690 ↑ 1.0 1 64,945

Index Scan using tabusuario_pk on tabusuario b (cost=0.42..2.28 rows=1 width=64) (actual time=0.042..0.042 rows=1 loops=64,945)

  • Index Cond: ((mi.id_uni_usu)::text = (id)::text)
29. 519.560 519.560 ↑ 1.0 1 64,945

Index Scan using tabusu_emp_pk on tabusu_emp c (cost=0.29..2.14 rows=1 width=24) (actual time=0.008..0.008 rows=1 loops=64,945)

  • Index Cond: ((b.id_contrato)::text = (id)::text)
30. 259.780 259.780 ↑ 1.0 1 64,945

Index Scan using tabusu_emp_modelo_pk on tabusu_emp_modelo mod (cost=0.14..0.96 rows=1 width=23) (actual time=0.004..0.004 rows=1 loops=64,945)

  • Index Cond: ((c.id_mod_contrato)::text = (id)::text)
31. 194.835 194.835 ↑ 1.0 1 64,945

Index Scan using tabusu_emp_modelo_modalidadecobranca_pk on tabusu_emp_modelo_modalidadecobranca mc (cost=0.13..0.20 rows=1 width=182) (actual time=0.003..0.003 rows=1 loops=64,945)

  • Index Cond: ((mod.id_modalidadecobranca)::text = (id)::text)
32. 194.835 194.835 ↑ 1.0 1 64,945

Index Scan using tabusu_emp_modelo_tipocontratacao_pk on tabusu_emp_modelo_tipocontratacao tc (cost=0.13..0.20 rows=1 width=182) (actual time=0.003..0.003 rows=1 loops=64,945)

  • Index Cond: ((mod.id_tipocontratacao)::text = (id)::text)
33. 259.780 259.780 ↑ 1.0 1 64,945

Index Scan using tabusu_produto_pk on tabusu_produto prod (cost=0.27..1.02 rows=1 width=20) (actual time=0.004..0.004 rows=1 loops=64,945)

  • Index Cond: ((mi.id_produto)::text = (id)::text)
34. 129.890 129.890 ↑ 1.0 1 64,945

Index Scan using tabusu_produto_segmentacao_pk on tabusu_produto_segmentacao cob (cost=0.14..0.18 rows=1 width=182) (actual time=0.002..0.002 rows=1 loops=64,945)

  • Index Cond: ((prod.id_segmentacao)::text = (id)::text)
35. 519.560 519.560 ↑ 1.0 1 64,945

Index Scan using tabservico_pk on tabservico s (cost=0.42..2.26 rows=1 width=67) (actual time=0.008..0.008 rows=1 loops=64,945)

  • Index Cond: ((mi.id_servico)::text = (id)::text)
36. 324.725 324.725 ↑ 1.0 1 64,945

Index Scan using tabctactb_pk on tabctactb cd (cost=0.28..1.66 rows=1 width=76) (actual time=0.005..0.005 rows=1 loops=64,945)

  • Index Cond: ((mic.id_ctactb_deb)::text = (id)::text)
37. 324.725 324.725 ↑ 1.0 1 64,945

Index Scan using tabctactb_pk on tabctactb cc (cost=0.28..1.66 rows=1 width=76) (actual time=0.005..0.005 rows=1 loops=64,945)

  • Index Cond: ((mic.id_ctactb_cre)::text = (id)::text)
38. 0.004 879.611 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=2.69..13,812.52 rows=1 width=934) (actual time=879.610..879.611 rows=0 loops=1)

39. 0.002 879.607 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.69..13,812.51 rows=1 width=906) (actual time=879.606..879.607 rows=0 loops=1)

  • Join Filter: ((apc.id_ctactb_cre)::text = (cc_1.id)::text)
40. 0.003 879.605 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.69..13,734.57 rows=1 width=819) (actual time=879.603..879.605 rows=0 loops=1)

  • Join Filter: ((apc.id_ctactb_deb)::text = (cd_1.id)::text)
41. 0.003 879.602 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.69..13,656.64 rows=1 width=759) (actual time=879.601..879.602 rows=0 loops=1)

42. 0.003 879.599 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.27..13,652.72 rows=1 width=705) (actual time=879.598..879.599 rows=0 loops=1)

  • Join Filter: ((prod_1.id_segmentacao)::text = (cob_1.id)::text)
43. 0.002 879.596 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.27..13,651.36 rows=1 width=593) (actual time=879.595..879.596 rows=0 loops=1)

  • Join Filter: ((apc.id_produto)::text = (prod_1.id)::text)
44. 0.003 879.594 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.27..13,630.10 rows=1 width=593) (actual time=879.593..879.594 rows=0 loops=1)

  • Join Filter: ((mod_1.id_tipocontratacao)::text = (tc_1.id)::text)
45. 0.003 879.591 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.27..13,628.96 rows=1 width=481) (actual time=879.590..879.591 rows=0 loops=1)

  • Join Filter: ((mod_1.id_modalidadecobranca)::text = (mc_1.id)::text)
46. 0.003 879.588 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.27..13,627.90 rows=1 width=369) (actual time=879.587..879.588 rows=0 loops=1)

  • Join Filter: ((c_1.id_mod_contrato)::text = (mod_1.id)::text)
47. 0.002 879.585 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.27..13,617.43 rows=1 width=368) (actual time=879.584..879.585 rows=0 loops=1)

48. 0.003 879.583 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.98..13,617.11 rows=1 width=369) (actual time=879.581..879.583 rows=0 loops=1)

49. 0.003 879.580 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.56..13,609.91 rows=1 width=333) (actual time=879.579..879.580 rows=0 loops=1)

  • Join Filter: ((p_1.id_classe)::text = (pc_1.id)::text)
50. 0.002 879.577 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.56..13,607.49 rows=1 width=320) (actual time=879.576..879.577 rows=0 loops=1)

51. 0.003 879.575 ↓ 0.0 0 1

Nested Loop (cost=1.27..13,607.19 rows=1 width=247) (actual time=879.573..879.575 rows=0 loops=1)

  • Join Filter: ((ap.id_ajuste)::text = (a_1.id)::text)
52. 0.251 879.572 ↓ 0.0 0 1

Nested Loop (cost=1.27..13,595.89 rows=1 width=225) (actual time=879.571..879.572 rows=0 loops=1)

53. 0.186 162.057 ↓ 51.0 51 1

Nested Loop (cost=0.85..11,383.73 rows=1 width=60) (actual time=160.712..162.057 rows=51 loops=1)

54. 0.041 0.041 ↑ 1.0 1 1

Index Scan using idx_tabdocfin_nr_doc on tabdocfin f_1 (cost=0.42..8.45 rows=1 width=35) (actual time=0.038..0.041 rows=1 loops=1)

  • Index Cond: (((id_emp)::text = '1'::text) AND ((nr_doc)::text = '8814904'::text))
55. 161.830 161.830 ↓ 4.6 51 1

Index Scan using idx_tabprest_ajuste_prest_docfin on tabprest_ajuste_prest ap (cost=0.42..11,375.18 rows=11 width=45) (actual time=160.660..161.830 rows=51 loops=1)

  • Index Cond: ((id_docfin)::text = (f_1.id)::text)
56. 717.264 717.264 ↓ 0.0 0 51

Index Scan using tabprest_ajuste_prest_composicao_bk on tabprest_ajuste_prest_composicao apc (cost=0.42..2,212.14 rows=1 width=194) (actual time=14.064..14.064 rows=0 loops=51)

  • Index Cond: ((id_ajuste_prestador)::text = (ap.id)::text)
  • Filter: ((date(dt_pir) >= '2020-05-01'::date) AND (date(dt_pir) <= '2020-05-31'::date))
57. 0.000 0.000 ↓ 0.0 0

Seq Scan on tabprest_ajuste a_1 (cost=0.00..7.80 rows=280 width=43) (never executed)

58. 0.000 0.000 ↓ 0.0 0

Index Scan using tabprestador_pk on tabprestador p_1 (cost=0.29..0.30 rows=1 width=86) (never executed)

  • Index Cond: ((ap.id_prestador)::text = (id)::text)
59. 0.000 0.000 ↓ 0.0 0

Seq Scan on tabprest_classe pc_1 (cost=0.00..1.63 rows=63 width=33) (never executed)

60. 0.000 0.000 ↓ 0.0 0

Index Scan using tabusuario_pk on tabusuario b_1 (cost=0.42..7.20 rows=1 width=64) (never executed)

  • Index Cond: ((apc.id_beneficiario)::text = (id)::text)
61. 0.000 0.000 ↓ 0.0 0

Index Scan using tabusu_emp_pk on tabusu_emp c_1 (cost=0.29..0.32 rows=1 width=24) (never executed)

  • Index Cond: ((b_1.id_contrato)::text = (id)::text)
62. 0.000 0.000 ↓ 0.0 0

Seq Scan on tabusu_emp_modelo mod_1 (cost=0.00..7.43 rows=243 width=23) (never executed)

63. 0.000 0.000 ↓ 0.0 0

Seq Scan on tabusu_emp_modelo_modalidadecobranca mc_1 (cost=0.00..1.03 rows=3 width=182) (never executed)

64. 0.000 0.000 ↓ 0.0 0

Seq Scan on tabusu_emp_modelo_tipocontratacao tc_1 (cost=0.00..1.06 rows=6 width=182) (never executed)

65. 0.000 0.000 ↓ 0.0 0

Seq Scan on tabusu_produto prod_1 (cost=0.00..15.56 rows=456 width=20) (never executed)

66. 0.000 0.000 ↓ 0.0 0

Seq Scan on tabusu_produto_segmentacao cob_1 (cost=0.00..1.16 rows=16 width=182) (never executed)

67. 0.000 0.000 ↓ 0.0 0

Index Scan using tabservico_pk on tabservico s_1 (cost=0.42..3.92 rows=1 width=67) (never executed)

  • Index Cond: ((apc.id_servico)::text = (id)::text)
68. 0.000 0.000 ↓ 0.0 0

Seq Scan on tabctactb cd_1 (cost=0.00..55.19 rows=1,819 width=76) (never executed)

69. 0.000 0.000 ↓ 0.0 0

Seq Scan on tabctactb cc_1 (cost=0.00..55.19 rows=1,819 width=76) (never executed)