explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xu0q : Optimization for: plan #Res3

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.001 0.140 ↓ 4.0 8 1

Append (cost=1.40..64.98 rows=2 width=181) (actual time=0.049..0.140 rows=8 loops=1)

2. 0.006 0.135 ↓ 8.0 8 1

Nested Loop (cost=1.40..38.73 rows=1 width=181) (actual time=0.049..0.135 rows=8 loops=1)

3. 0.003 0.113 ↓ 8.0 8 1

Nested Loop (cost=0.98..30.28 rows=1 width=198) (actual time=0.039..0.113 rows=8 loops=1)

4. 0.005 0.102 ↓ 8.0 8 1

Nested Loop (cost=0.84..30.12 rows=1 width=96) (actual time=0.034..0.102 rows=8 loops=1)

5. 0.002 0.065 ↓ 8.0 8 1

Nested Loop (cost=0.42..21.67 rows=1 width=72) (actual time=0.024..0.065 rows=8 loops=1)

  • Join Filter: (v.empresa_id = e.empresa_id)
  • Rows Removed by Join Filter: 72
6. 0.013 0.013 ↓ 10.0 10 1

Seq Scan on empresa e (cost=0.00..1.13 rows=1 width=16) (actual time=0.011..0.013 rows=10 loops=1)

  • Filter: ((ativa)::bpchar = '1'::bpchar)
7. 0.050 0.050 ↓ 2.0 8 10

Index Scan using idx_vendas_pagante_id on vendas v (cost=0.42..20.50 rows=4 width=72) (actual time=0.002..0.005 rows=8 loops=10)

  • Index Cond: (pagante_id = '9a8fdea4-a91f-4fc7-95a8-66abe6192b82'::uuid)
  • Filter: (situacao <> 'C'::bpchar)
8. 0.032 0.032 ↑ 1.0 1 8

Index Scan using idx_vendas_produtos_vendas_id on vendas_produtos vp (cost=0.42..8.44 rows=1 width=40) (actual time=0.004..0.004 rows=1 loops=8)

  • Index Cond: (vendas_id = v.id)
  • Filter: (status <> 2)
9. 0.008 0.008 ↑ 1.0 1 8

Index Scan using pk_produtos on produtos (cost=0.14..0.16 rows=1 width=134) (actual time=0.001..0.001 rows=1 loops=8)

  • Index Cond: (id = vp.produto_id)
10. 0.016 0.016 ↑ 1.0 1 8

Index Only Scan using pk_pessoa on pessoa pagante (cost=0.42..8.44 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=8)

  • Index Cond: (pessoa_id = '9a8fdea4-a91f-4fc7-95a8-66abe6192b82'::uuid)
  • Heap Fetches: 8
11. 0.000 0.004 ↓ 0.0 0 1

Nested Loop (cost=1.67..26.22 rows=1 width=181) (actual time=0.004..0.004 rows=0 loops=1)

12. 0.000 0.004 ↓ 0.0 0 1

Nested Loop (cost=1.25..17.77 rows=1 width=198) (actual time=0.004..0.004 rows=0 loops=1)

13. 0.000 0.004 ↓ 0.0 0 1

Nested Loop (cost=1.12..17.60 rows=1 width=198) (actual time=0.004..0.004 rows=0 loops=1)

14. 0.000 0.004 ↓ 0.0 0 1

Nested Loop (cost=0.70..16.75 rows=1 width=158) (actual time=0.004..0.004 rows=0 loops=1)

15. 0.000 0.004 ↓ 0.0 0 1

Nested Loop (cost=0.56..16.60 rows=1 width=56) (actual time=0.004..0.004 rows=0 loops=1)

16. 0.004 0.004 ↓ 0.0 0 1

Index Scan using idx_vendas_produtos_passageiros_pessoa_id on vendas_produtos_passageiros vpp (cost=0.14..8.16 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: (pessoa_id = '9a8fdea4-a91f-4fc7-95a8-66abe6192b82'::uuid)
17. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_vendas_produtos on vendas_produtos vp_1 (cost=0.42..8.44 rows=1 width=56) (never executed)

  • Index Cond: (vendas_produtos_id = vpp.vendas_produtos_id)
  • Filter: (status <> 2)
18. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_produtos on produtos produtos_1 (cost=0.14..0.16 rows=1 width=134) (never executed)

  • Index Cond: (id = vp_1.produto_id)
19. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_vendas on vendas v_1 (cost=0.42..0.84 rows=1 width=56) (never executed)

  • Index Cond: (id = vp_1.vendas_id)
  • Filter: (situacao <> 'C'::bpchar)
20. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_empresa on empresa e_1 (cost=0.14..0.16 rows=1 width=16) (never executed)

  • Index Cond: (empresa_id = v_1.empresa_id)
  • Filter: ((ativa)::bpchar = '1'::bpchar)
21. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_pessoa on pessoa passageiro (cost=0.42..8.44 rows=1 width=16) (never executed)

  • Index Cond: (pessoa_id = '9a8fdea4-a91f-4fc7-95a8-66abe6192b82'::uuid)
  • Heap Fetches: 0
Planning time : 1.998 ms