explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ISoxv

Settings
# exclusive inclusive rows x rows loops node
1. 14.056 1,565.266 ↑ 1.0 5,000 1

Limit (cost=39,148.32..53,668.93 rows=5,000 width=1,215) (actual time=1,093.574..1,565.266 rows=5,000 loops=1)

2. 0.000 1,551.210 ↑ 10.0 5,000 1

Merge Left Join (cost=39,148.32..184,424.15 rows=50,024 width=1,215) (actual time=1,093.572..1,551.210 rows=5,000 loops=1)

  • Merge Cond: (v.id = vpr.vendas_id)
3. 0.000 498.106 ↑ 10.0 5,000 1

Gather Merge (cost=1,003.38..143,580.93 rows=50,024 width=699) (actual time=111.120..498.106 rows=5,000 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 9.729 1,012.074 ↑ 11.9 1,750 3

Nested Loop Left Join (cost=3.35..136,806.89 rows=20,843 width=699) (actual time=5.027..337.358 rows=1,750 loops=3)

5. 8.373 1,002.345 ↑ 11.9 1,750 3

Nested Loop Left Join (cost=3.21..133,517.45 rows=20,843 width=671) (actual time=5.017..334.115 rows=1,750 loops=3)

6. 8.769 993.972 ↑ 11.9 1,750 3

Nested Loop Left Join (cost=2.79..116,934.20 rows=20,843 width=648) (actual time=5.007..331.324 rows=1,750 loops=3)

7. 9.768 985.203 ↑ 11.9 1,750 3

Nested Loop Left Join (cost=2.38..100,350.57 rows=20,843 width=625) (actual time=4.992..328.401 rows=1,750 loops=3)

8. 9.765 975.435 ↑ 11.9 1,750 3

Nested Loop Left Join (cost=1.96..83,767.32 rows=20,843 width=602) (actual time=4.974..325.145 rows=1,750 loops=3)

9. 9.235 965.670 ↑ 11.9 1,750 3

Nested Loop (cost=1.54..67,184.07 rows=20,843 width=579) (actual time=4.956..321.890 rows=1,750 loops=3)

10. 12.038 930.180 ↑ 11.9 1,750 3

Nested Loop (cost=1.13..50,600.82 rows=20,843 width=556) (actual time=4.229..310.060 rows=1,750 loops=3)

11. 15.925 834.126 ↑ 11.9 1,750 3

Nested Loop (cost=0.71..34,017.56 rows=20,843 width=533) (actual time=3.566..278.042 rows=1,750 loops=3)

12. 35.802 35.802 ↑ 11.9 1,750 3

Parallel Index Scan using pk_vendas on vendas v (cost=0.29..17,434.31 rows=20,843 width=486) (actual time=0.460..11.934 rows=1,750 loops=3)

13. 782.399 782.399 ↑ 1.0 1 5,251

Index Scan using pk_pessoa on pessoa c (cost=0.42..0.80 rows=1 width=63) (actual time=0.149..0.149 rows=1 loops=5,251)

  • Index Cond: (pessoa_id = v.pagante_id)
14. 84.016 84.016 ↑ 1.0 1 5,251

Index Scan using pk_pessoa on pessoa u (cost=0.42..0.80 rows=1 width=39) (actual time=0.016..0.016 rows=1 loops=5,251)

  • Index Cond: (pessoa_id = v.vendedor_id)
15. 26.255 26.255 ↑ 1.0 1 5,251

Index Scan using pk_pessoa on pessoa l (cost=0.42..0.80 rows=1 width=39) (actual time=0.005..0.005 rows=1 loops=5,251)

  • Index Cond: (pessoa_id = v.empresa_id)
16. 0.000 0.000 ↓ 0.0 0 5,251

Index Scan using pk_pessoa on pessoa i (cost=0.42..0.80 rows=1 width=39) (actual time=0.000..0.000 rows=0 loops=5,251)

  • Index Cond: (v.intermediario_id = pessoa_id)
17. 0.000 0.000 ↓ 0.0 0 5,251

Index Scan using pk_pessoa on pessoa s (cost=0.42..0.80 rows=1 width=39) (actual time=0.000..0.000 rows=0 loops=5,251)

  • Index Cond: (v.solicitante_id = pessoa_id)
18. 0.000 0.000 ↓ 0.0 0 5,251

Index Scan using pk_pessoa on pessoa p (cost=0.42..0.80 rows=1 width=39) (actual time=0.000..0.000 rows=0 loops=5,251)

  • Index Cond: (v.promotor_id = pessoa_id)
19. 0.000 0.000 ↓ 0.0 0 5,251

Index Scan using pk_pessoa on pessoa a (cost=0.42..0.80 rows=1 width=39) (actual time=0.000..0.000 rows=0 loops=5,251)

  • Index Cond: (v.aprovador_id = pessoa_id)
20. 0.000 0.000 ↓ 0.0 0 5,251

Index Scan using pk_produtos on produtos pro (cost=0.14..0.16 rows=1 width=44) (actual time=0.000..0.000 rows=0 loops=5,251)

  • Index Cond: (id = v.operacao_propria_id)
21. 64.842 1,053.715 ↑ 9.0 4,989 1

GroupAggregate (cost=38,144.94..39,710.30 rows=44,794 width=532) (actual time=982.445..1,053.715 rows=4,989 loops=1)

  • Group Key: vpr.vendas_id
22. 116.904 988.873 ↑ 9.9 12,067 1

Sort (cost=38,144.94..38,442.76 rows=119,127 width=39) (actual time=982.228..988.873 rows=12,067 loops=1)

  • Sort Key: vpr.vendas_id
  • Sort Method: external merge Disk: 5944kB
23. 116.906 871.969 ↓ 1.0 121,143 1

Hash Join (cost=15,347.12..24,842.76 rows=119,127 width=39) (actual time=595.477..871.969 rows=121,143 loops=1)

  • Hash Cond: (vpp.pessoa_id = ps.pessoa_id)
24. 105.412 451.374 ↓ 1.0 121,143 1

Hash Join (cost=9,016.29..16,030.19 rows=119,127 width=32) (actual time=291.358..451.374 rows=121,143 loops=1)

  • Hash Cond: (vpp.vendas_produtos_id = vpr.vendas_produtos_id)
25. 55.029 55.029 ↓ 1.0 121,276 1

Seq Scan on vendas_produtos_passageiros vpp (cost=0.00..4,624.58 rows=121,258 width=32) (actual time=0.023..55.029 rows=121,276 loops=1)

26. 38.364 290.933 ↓ 1.0 61,356 1

Hash (cost=7,849.15..7,849.15 rows=60,331 width=32) (actual time=290.933..290.933 rows=61,356 loops=1)

  • Buckets: 65536 Batches: 2 Memory Usage: 2447kB
27. 252.569 252.569 ↓ 1.0 61,356 1

Seq Scan on vendas_produtos vpr (cost=0.00..7,849.15 rows=60,331 width=32) (actual time=0.029..252.569 rows=61,356 loops=1)

  • Filter: ((status = 0) OR (status = 1))
  • Rows Removed by Filter: 65
28. 46.892 303.689 ↑ 1.0 68,913 1

Hash (cost=4,930.26..4,930.26 rows=68,926 width=39) (actual time=303.689..303.689 rows=68,913 loops=1)

  • Buckets: 65536 Batches: 2 Memory Usage: 2918kB
29. 256.797 256.797 ↑ 1.0 68,913 1

Seq Scan on pessoa ps (cost=0.00..4,930.26 rows=68,926 width=39) (actual time=0.628..256.797 rows=68,913 loops=1)

Planning time : 197.743 ms