explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rcyx

Settings
# exclusive inclusive rows x rows loops node
1. 0.091 1,280.042 ↑ 3.0 2 1

Subquery Scan on a (cost=133,656.19..133,656.34 rows=6 width=230) (actual time=1,280.039..1,280.042 rows=2 loops=1)

2. 0.018 1,279.951 ↑ 3.0 2 1

HashAggregate (cost=133,656.19..133,656.25 rows=6 width=230) (actual time=1,279.950..1,279.951 rows=2 loops=1)

  • Group Key: pedidos.ad_client_id, pedidos.ad_org_id, pedidos.c_order_id, pedidos.documentno, pedidos.c_doctypetarget_id, pedidos.dateordered, pedidos.docstatus, pedidos.created, pedidos.updated, pedidos.createdby, pedidos.updatedby
3.          

CTE pedidos

4. 99.050 99.050 ↓ 1.0 209,775 1

Seq Scan on c_order o (cost=0.00..19,509.70 rows=209,570 width=72) (actual time=0.020..99.050 rows=209,775 loops=1)

5.          

CTE expedicoes

6. 66.631 66.631 ↓ 1.0 240,846 1

Seq Scan on m_inout io (cost=0.00..12,541.24 rows=240,524 width=74) (actual time=0.009..66.631 rows=240,846 loops=1)

7.          

CTE faturas

8. 99.925 99.925 ↑ 1.0 255,868 1

Seq Scan on c_invoice i (cost=0.00..16,136.90 rows=256,490 width=73) (actual time=0.006..99.925 rows=255,868 loops=1)

9.          

CTE notasfiscais

10. 280.453 280.453 ↑ 1.0 208,220 1

Seq Scan on lbr_docfiscal df (cost=0.00..43,742.35 rows=208,635 width=72) (actual time=0.015..280.453 rows=208,220 loops=1)

11.          

CTE listadeembarque

12. 51.434 62.118 ↓ 1.0 84,796 1

Hash Left Join (cost=318.09..5,301.32 rows=84,791 width=128) (actual time=3.640..62.118 rows=84,796 loops=1)

  • Hash Cond: (pll.cof_packinglist_id = pl.cof_packinglist_id)
13. 7.077 7.077 ↓ 1.0 84,796 1

Seq Scan on cof_packinglist_line pll (cost=0.00..3,488.91 rows=84,791 width=13) (actual time=0.007..7.077 rows=84,796 loops=1)

14. 1.605 3.607 ↑ 1.0 6,079 1

Hash (cost=241.93..241.93 rows=6,093 width=66) (actual time=3.607..3.607 rows=6,079 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 712kB
15. 2.002 2.002 ↑ 1.0 6,079 1

Seq Scan on cof_packinglist pl (cost=0.00..241.93 rows=6,093 width=66) (actual time=0.004..2.002 rows=6,079 loops=1)

16.          

CTE devolucao

17. 3.587 36.305 ↑ 2.6 1,308 1

HashAggregate (cost=8,797.88..8,831.56 rows=3,368 width=65) (actual time=36.002..36.305 rows=1,308 loops=1)

  • Group Key: arm.ad_client_id, arm.ad_org_id, ol.c_order_id, arm.documentno, arm.c_doctype_id, arm.created, arm.docstatus, arm.updated, arm.createdby, arm.updatedby
18. 1.562 32.718 ↓ 1.0 3,380 1

Nested Loop Left Join (cost=1.41..8,713.68 rows=3,368 width=65) (actual time=0.061..32.718 rows=3,380 loops=1)

19. 1.715 17.636 ↓ 1.0 3,380 1

Merge Right Join (cost=0.98..6,959.49 rows=3,368 width=64) (actual time=0.045..17.636 rows=3,380 loops=1)

  • Merge Cond: (arml.m_rma_id = arm.m_rma_id)
20. 1.323 15.599 ↓ 1.0 3,369 1

Nested Loop Left Join (cost=0.71..6,837.54 rows=3,368 width=12) (actual time=0.033..15.599 rows=3,369 loops=1)

21. 0.800 0.800 ↓ 1.0 3,369 1

Index Scan using idx_m_rmaline_m_rma_id on m_rmaline arml (cost=0.28..154.10 rows=3,368 width=13) (actual time=0.014..0.800 rows=3,369 loops=1)

22. 13.476 13.476 ↑ 1.0 1 3,369

Index Scan using m_inoutline_pkey on m_inoutline iol (cost=0.42..1.98 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=3,369)

  • Index Cond: (m_inoutline_id = arml.m_inoutline_id)
23. 0.322 0.322 ↓ 1.0 1,308 1

Index Scan using m_rma_pkey on m_rma arm (cost=0.28..76.58 rows=1,307 width=64) (actual time=0.008..0.322 rows=1,308 loops=1)

24. 13.520 13.520 ↑ 1.0 1 3,380

Index Scan using c_orderline_pkey on c_orderline ol (cost=0.42..0.52 rows=1 width=13) (actual time=0.004..0.004 rows=1 loops=3,380)

  • Index Cond: (c_orderline_id = iol.c_orderline_id)
25. 0.008 1,279.933 ↑ 3.0 2 1

Append (cost=0.00..27,592.96 rows=6 width=230) (actual time=230.701..1,279.933 rows=2 loops=1)

26. 232.575 232.575 ↑ 1.0 1 1

CTE Scan on pedidos (cost=0.00..5,763.18 rows=1 width=210) (actual time=230.700..232.575 rows=1 loops=1)

  • Filter: ((ad_client_id = ANY ('{0,1000001}'::numeric[])) AND (ad_org_id = ANY ('{0,1000002}'::numeric[])) AND (c_order_id = '5212023'::numeric))
  • Rows Removed by Filter: 209774
27. 214.658 214.658 ↑ 1.0 1 1

CTE Scan on expedicoes (cost=0.00..6,614.41 rows=1 width=210) (actual time=213.824..214.658 rows=1 loops=1)

  • Filter: ((ad_client_id = ANY ('{0,1000001}'::numeric[])) AND (ad_org_id = ANY ('{0,1000002}'::numeric[])) AND (c_order_id = '5212023'::numeric))
  • Rows Removed by Filter: 240845
28. 258.185 258.185 ↓ 0.0 0 1

CTE Scan on faturas (cost=0.00..7,053.48 rows=1 width=210) (actual time=258.185..258.185 rows=0 loops=1)

  • Filter: ((ad_client_id = ANY ('{0,1000001}'::numeric[])) AND (ad_org_id = ANY ('{0,1000002}'::numeric[])) AND (c_order_id = '5212023'::numeric))
  • Rows Removed by Filter: 255868
29. 0.001 414.210 ↓ 0.0 0 1

Subquery Scan on *SELECT* 4 (cost=0.00..5,737.47 rows=1 width=230) (actual time=414.210..414.210 rows=0 loops=1)

30. 414.209 414.209 ↓ 0.0 0 1

CTE Scan on notasfiscais (cost=0.00..5,737.46 rows=1 width=210) (actual time=414.209..414.209 rows=0 loops=1)

  • Filter: ((ad_client_id = ANY ('{0,1000001}'::numeric[])) AND (ad_org_id = ANY ('{0,1000002}'::numeric[])) AND (c_order_id = '5212023'::numeric))
  • Rows Removed by Filter: 208220
31. 0.000 123.151 ↓ 0.0 0 1

Subquery Scan on *SELECT* 5 (cost=0.00..2,331.76 rows=1 width=230) (actual time=123.151..123.151 rows=0 loops=1)

32. 123.151 123.151 ↓ 0.0 0 1

CTE Scan on listadeembarque (cost=0.00..2,331.75 rows=1 width=230) (actual time=123.151..123.151 rows=0 loops=1)

  • Filter: ((ad_client_id = ANY ('{0,1000001}'::numeric[])) AND (ad_org_id = ANY ('{0,1000002}'::numeric[])) AND (c_order_id = '5212023'::numeric))
  • Rows Removed by Filter: 84796
33. 37.146 37.146 ↓ 0.0 0 1

CTE Scan on devolucao (cost=0.00..92.62 rows=1 width=210) (actual time=37.146..37.146 rows=0 loops=1)

  • Filter: ((ad_client_id = ANY ('{0,1000001}'::numeric[])) AND (ad_org_id = ANY ('{0,1000002}'::numeric[])) AND (c_order_id = '5212023'::numeric))
  • Rows Removed by Filter: 1308