explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VUhs

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=208,507.82..208,507.89 rows=1 width=233) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Unique (cost=208,507.82..208,507.89 rows=1 width=233) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Sort (cost=208,507.82..208,507.82 rows=1 width=233) (actual rows= loops=)

  • Sort Key: p.protocolo_processo, p.id_processo, p.id_imovel, pv.nome_razao, (CASE WHEN (pv.tipo_pessoa = 'F'::bpchar) THEN regexp_replace((pv.cpf)::text, '(\d{3})(\d{3})(\d{3})'::text, '\1.\2.\3-'::text) ELSE regexp_replace((pv.cnpj)::text, '( (...)
4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=323.77..208,507.81 rows=1 width=233) (actual rows= loops=)

  • Join Filter: (p.id_unidade_regional = ur.id_unidade_regional)
5. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=323.77..208,269.55 rows=1 width=228) (actual rows= loops=)

  • Join Filter: (sitdevfiscal.id_situacao_devolucao_fiscal = p.flg_pendencia_devolucao_fiscal_id_situacao)
6. 0.000 0.000 ↓ 0.0

Nested Loop Semi Join (cost=323.77..208,268.30 rows=1 width=197) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Merge Join (cost=323.48..208,257.23 rows=1 width=201) (actual rows= loops=)

  • Merge Cond: (n.id_notificacao = m.id_notificacao)
8. 0.000 0.000 ↓ 0.0

Nested Loop (cost=320.97..229,048.02 rows=22 width=205) (actual rows= loops=)

  • Join Filter: (v.id_processo = n.id_processo)
9. 0.000 0.000 ↓ 0.0

Index Scan using id_notificacao_idx on notificacao n (cost=0.29..388.95 rows=9,215 width=8) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Materialize (cost=320.68..225,756.41 rows=21 width=213) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Nested Loop (cost=320.68..225,756.30 rows=21 width=213) (actual rows= loops=)

  • Join Filter: (iv.tipo_logradouro = tl.id_tipo_logradouro)
12. 0.000 0.000 ↓ 0.0

Nested Loop (cost=320.68..225,751.70 rows=21 width=211) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Nested Loop (cost=320.40..225,744.26 rows=21 width=163) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Nested Loop (cost=320.11..225,737.04 rows=21 width=99) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Nested Loop (cost=319.82..225,735.33 rows=3 width=91) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Nested Loop (cost=319.82..225,735.23 rows=3 width=73) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Hash Join (cost=315.31..3,640.15 rows=25,234 width=53) (actual rows= loops=)

  • Hash Cond: (v.id_processo = p.id_processo)
18. 0.000 0.000 ↓ 0.0

Seq Scan on vistorias v (cost=0.00..2,741.11 rows=26,511 width=4) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Hash (cost=208.47..208.47 rows=8,547 width=49) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Seq Scan on processo p (cost=0.00..208.47 rows=8,547 width=49) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Index Scan using id_historico_processo_idx on historico_processo hp (cost=4.52..8.79 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_historico_processo = (SubPlan 19))
  • Filter: (v.id_processo = processo_id_processo)
22.          

SubPlan (for Index Scan)

23. 0.000 0.000 ↓ 0.0

Aggregate (cost=4.22..4.23 rows=1 width=4) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Index Scan using processo_id_processo_idx on historico_processo (cost=0.29..4.21 rows=4 width=4) (actual rows= loops=)

  • Index Cond: (processo_id_processo = v.id_processo)
25. 0.000 0.000 ↓ 0.0

Index Scan using pk_id_situacao_processo on situacao_processo sp (cost=0.00..0.02 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (id_situacao_processo = hp.situacao_id_situacao)
  • Filter: (id_situacao_processo > 0)
26. 0.000 0.000 ↓ 0.0

Index Scan using idx_tramitacao_idp on tramitacao t (cost=0.29..0.50 rows=7 width=8) (actual rows= loops=)

  • Index Cond: (id_processo = v.id_processo)
27. 0.000 0.000 ↓ 0.0

Index Scan using imovel_versao_pkey on imovel_versao iv (cost=0.29..0.33 rows=1 width=68) (actual rows= loops=)

  • Index Cond: (id_imovel_versao = p.id_imovel)
28. 0.000 0.000 ↓ 0.0

Index Scan using proprietario_versao_pkey on proprietario_versao pv (cost=0.29..0.34 rows=1 width=52) (actual rows= loops=)

  • Index Cond: (id_proprietario_versao = p.id_proprietario)
29. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.17 rows=11 width=10) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Seq Scan on tipo_logradouro tl (cost=0.00..1.11 rows=11 width=10) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Sort (cost=2.51..2.51 rows=1 width=4) (actual rows= loops=)

  • Sort Key: m.id_notificacao
32. 0.000 0.000 ↓ 0.0

Index Scan using unicidade_multa_numero_ar on multa m (cost=0.28..2.50 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_multa = 22289)
33. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.29..5.68 rows=1 width=8) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Index Scan using tramitacao_pkey on tramitacao t2 (cost=0.29..0.34 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id_tramitacao = t.id_tramitacao)
35. 0.000 0.000 ↓ 0.0

Index Scan using pk_id_vistoria on vistorias v2 (cost=0.00..5.33 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_vistoria = t2.vistoria_id_vistoria)
  • Filter: (t2.id_tramitacao = (SubPlan 20))
36.          

SubPlan (for Index Scan)

37. 0.000 0.000 ↓ 0.0

Aggregate (cost=5.25..5.26 rows=1 width=4) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Index Scan using idx_sdf_idsdf on tramitacao (cost=0.29..5.24 rows=6 width=4) (actual rows= loops=)

  • Index Cond: (vistoria_id_vistoria = v2.id_vistoria)
39. 0.000 0.000 ↓ 0.0

Seq Scan on situacao_devolucao_fiscal sitdevfiscal (cost=0.00..1.11 rows=11 width=33) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Seq Scan on unidade_regional ur (cost=0.00..1.19 rows=19 width=9) (actual rows= loops=)

41.          

SubPlan (for Nested Loop)

42. 0.000 0.000 ↓ 0.0

Aggregate (cost=28.05..28.06 rows=1 width=4) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Unique (cost=28.02..28.03 rows=2 width=16) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Sort (cost=28.02..28.02 rows=2 width=16) (actual rows= loops=)

  • Sort Key: (min(CASE WHEN (subn.prazo_recurso_concedido IS NOT NULL) THEN subn.prazo_recurso_concedido ELSE (COALESCE(subn.data_publicacao_dom, subn.data_entrega) + CASE WHEN (subn.prazo < 15) THEN 15 ELSE subn.prazo (...)
45. 0.000 0.000 ↓ 0.0

Append (cost=14.45..28.01 rows=2 width=16) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

Aggregate (cost=14.45..14.46 rows=1 width=16) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Result (cost=9.04..14.44 rows=1 width=16) (actual rows= loops=)

  • One-Time Filter: (p.id_situacao <> ALL ('{7,8}'::integer[]))
48. 0.000 0.000 ↓ 0.0

Nested Loop (cost=9.04..14.44 rows=1 width=16) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Index Scan using idx_notificacao_idp on notificacao subn (cost=8.75..11.91 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_processo = p.id_processo)
  • Filter: ((COALESCE(prazo_recurso_concedido, data_publicacao_dom, data_entrega) IS NOT NULL) AND (NOT (hashed SubPlan 2)) AND (id_situacao_notificacao = 1))
50.          

SubPlan (for Index Scan)

51. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.57..8.46 rows=1 width=4) (actual rows= loops=)

52. 0.000 0.000 ↓ 0.0

Index Scan using idx_notificacao_idp on notificacao n11 (cost=0.29..3.44 rows=2 width=4) (actual rows= loops=)

  • Index Cond: (id_processo = p.id_processo)
53. 0.000 0.000 ↓ 0.0

Index Only Scan using idx_multa_idnidsm on multa m1a (cost=0.28..2.50 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_notificacao = n11.id_notificacao)
54. 0.000 0.000 ↓ 0.0

Index Scan using vistoria_servico_pkey on vistoria_servico vs1 (cost=0.29..2.51 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_vistoria_servico = subn.id_vistoria_servico)
  • Filter: ((ativo = 1) AND (id_situacao_vistoria_servico = 3))
55. 0.000 0.000 ↓ 0.0

Aggregate (cost=13.52..13.53 rows=1 width=16) (actual rows= loops=)

56. 0.000 0.000 ↓ 0.0

Result (cost=0.85..13.52 rows=1 width=16) (actual rows= loops=)

  • One-Time Filter: (p.id_situacao <> ALL ('{7,8}'::integer[]))
57. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..13.52 rows=1 width=16) (actual rows= loops=)

58. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.57..8.49 rows=1 width=8) (actual rows= loops=)

59. 0.000 0.000 ↓ 0.0

Index Scan using idx_notificacao_idp on notificacao subn2 (cost=0.29..3.44 rows=2 width=12) (actual rows= loops=)

  • Index Cond: (id_processo = p.id_processo)
60. 0.000 0.000 ↓ 0.0

Index Scan using vistoria_servico_pkey on vistoria_servico vs2 (cost=0.29..2.51 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_vistoria_servico = subn2.id_vistoria_servico)
  • Filter: ((id_situacao_vistoria_servico = 3) AND (ativo = 1))
61. 0.000 0.000 ↓ 0.0

Index Scan using idx_multa_idnidsm on multa subm (cost=0.28..5.02 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_notificacao = subn2.id_notificacao)
  • Filter: ((COALESCE(prazo_recurso_concedido, data_publicacao_dom, data_entrega) IS NOT NULL) AND (id_situacao_multa = ANY ('{1,4}'::integer[])) AND ((SubPlan 1) = id_multa))
62.          

SubPlan (for Index Scan)

63. 0.000 0.000 ↓ 0.0

Aggregate (cost=2.50..2.51 rows=1 width=4) (actual rows= loops=)

64. 0.000 0.000 ↓ 0.0

Index Scan using idx_multa_idnidsm on multa (cost=0.28..2.50 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_notificacao = subn2.id_notificacao)
  • Filter: (id_situacao_multa = ANY ('{1,4}'::integer[]))
65. 0.000 0.000 ↓ 0.0

Index Scan using idx_tramitacao_idp on tramitacao tfpag1 (cost=0.29..49.59 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_processo = p.id_processo)
  • Filter: (((protocolo)::text = (p.protocolo_processo)::text) AND (id_tramitacao = (SubPlan 4)))
66.          

SubPlan (for Index Scan)

67. 0.000 0.000 ↓ 0.0

Aggregate (cost=6.19..6.20 rows=1 width=4) (actual rows= loops=)

68. 0.000 0.000 ↓ 0.0

Index Scan using idx_tramitacao_idp on tramitacao tsfpag1 (cost=0.29..6.18 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_processo = tfpag1.id_processo)
  • Filter: ((protocolo)::text = (tfpag1.protocolo)::text)
69. 0.000 0.000 ↓ 0.0

Index Scan using idx_tramitacao_idp on tramitacao tfpag2 (cost=0.29..56.68 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_processo = p.id_processo)
  • Filter: (((protocolo)::text = (p.protocolo_processo)::text) AND (id_tramitacao = (SubPlan 9)))
70.          

SubPlan (for Index Scan)

71. 0.000 0.000 ↓ 0.0

HashAggregate (cost=2.36..2.37 rows=1 width=21) (actual rows= loops=)

72. 0.000 0.000 ↓ 0.0

Index Scan using usuario_pkey on usuario u1 (cost=0.14..2.36 rows=1 width=21) (actual rows= loops=)

  • Index Cond: (id_usuario = tfpag2.id_usuario_destino)
73. 0.000 0.000 ↓ 0.0

HashAggregate (cost=2.36..2.37 rows=1 width=21) (actual rows= loops=)

74. 0.000 0.000 ↓ 0.0

Index Scan using usuario_pkey on usuario u1fpag (cost=0.14..2.36 rows=1 width=21) (actual rows= loops=)

  • Index Cond: (id_usuario = tfpag2.id_usuario_origem)
75. 0.000 0.000 ↓ 0.0

HashAggregate (cost=2.36..2.37 rows=1 width=21) (actual rows= loops=)

76. 0.000 0.000 ↓ 0.0

Index Scan using usuario_pkey on usuario u1fpag_1 (cost=0.14..2.36 rows=1 width=21) (actual rows= loops=)

  • Index Cond: (id_usuario = tfpag2.id_usuario_destino)
77. 0.000 0.000 ↓ 0.0

Aggregate (cost=6.19..6.20 rows=1 width=4) (actual rows= loops=)

78. 0.000 0.000 ↓ 0.0

Index Scan using idx_tramitacao_idp on tramitacao tsfpag2 (cost=0.29..6.18 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_processo = tfpag2.id_processo)
  • Filter: ((protocolo)::text = (tfpag2.protocolo)::text)
79. 0.000 0.000 ↓ 0.0

Index Scan using idx_tramitacao_idp on tramitacao tfpag3 (cost=0.29..52.88 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_processo = p.id_processo)
  • Filter: (((protocolo)::text = (p.protocolo_processo)::text) AND (id_tramitacao = (SubPlan 15)))
80.          

SubPlan (for Index Scan)

81. 0.000 0.000 ↓ 0.0

Result (cost=2.20..2.21 rows=1 width=0) (actual rows= loops=)

82.          

Initplan (for Result)

83. 0.000 0.000 ↓ 0.0

Seq Scan on centro_custo cfpag3 (cost=0.00..1.10 rows=1 width=18) (actual rows= loops=)

  • Filter: (id_centro_custo = 7)
84. 0.000 0.000 ↓ 0.0

Seq Scan on centro_custo cfpag3_1 (cost=0.00..1.10 rows=1 width=18) (actual rows= loops=)

  • Filter: (id_centro_custo = tfpag3.id_cc_destino)
85. 0.000 0.000 ↓ 0.0

Seq Scan on centro_custo cfpag3_2 (cost=0.00..1.10 rows=1 width=18) (actual rows= loops=)

  • Filter: (id_centro_custo = tfpag3.id_cc_destino)
86. 0.000 0.000 ↓ 0.0

Aggregate (cost=6.19..6.20 rows=1 width=4) (actual rows= loops=)

87. 0.000 0.000 ↓ 0.0

Index Scan using idx_tramitacao_idp on tramitacao tsfpag3 (cost=0.29..6.18 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_processo = tfpag3.id_processo)
  • Filter: ((protocolo)::text = (tfpag3.protocolo)::text)
88. 0.000 0.000 ↓ 0.0

Index Scan using idx_tramitacao_idp on tramitacao tfpag4 (cost=0.29..49.57 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_processo = p.id_processo)
  • Filter: (((protocolo)::text = (p.protocolo_processo)::text) AND (id_tramitacao = (SubPlan 17)))
89.          

SubPlan (for Index Scan)

90. 0.000 0.000 ↓ 0.0

Aggregate (cost=6.19..6.20 rows=1 width=4) (actual rows= loops=)

91. 0.000 0.000 ↓ 0.0

Index Scan using idx_tramitacao_idp on tramitacao tsfpag4 (cost=0.29..6.18 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id_processo = tfpag4.id_processo)
  • Filter: ((protocolo)::text = (tfpag4.protocolo)::text)