explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ecrdW

Settings
# exclusive inclusive rows x rows loops node
1. 10.775 12,424.828 ↓ 1.4 1,000 1

Limit (cost=1,533.63..1,442,987.24 rows=697 width=121) (actual time=102.856..12,424.828 rows=1,000 loops=1)

2. 13.931 12,414.053 ↓ 1.4 1,000 1

Nested Loop (cost=1,533.63..1,442,987.24 rows=697 width=121) (actual time=102.855..12,414.053 rows=1,000 loops=1)

3. 0.000 890.122 ↓ 1.6 1,000 1

Nested Loop (cost=1,533.36..36,049.54 rows=608 width=30) (actual time=102.202..890.122 rows=1,000 loops=1)

4. 0.000 124.308 ↓ 1.6 1,000 1

Gather (cost=1,524.74..30,795.81 rows=608 width=32) (actual time=102.152..124.308 rows=1,000 loops=1)

  • Workers Planned: 3
  • Workers Launched: 3
5. 3.213 144.404 ↓ 5.2 1,018 4 / 4

Nested Loop (cost=524.74..29,735.01 rows=196 width=32) (actual time=95.085..144.404 rows=1,018 loops=4)

6. 95.977 111.676 ↑ 3.0 1,018 4 / 4

Parallel Bitmap Heap Scan on contrato c (cost=524.31..17,198.82 rows=3,075 width=22) (actual time=94.970..111.676 rows=1,018 loops=4)

  • Recheck Cond: ((carcod = 100) AND (conati = 0) AND (convalsal > '0'::numeric))
  • Heap Blocks: exact=1
7. 15.699 15.699 ↓ 28.2 268,384 1 / 4

Bitmap Index Scan on contrato_iu0014 (cost=0.00..521.93 rows=9,534 width=0) (actual time=62.795..62.795 rows=268,384 loops=1)

  • Index Cond: (carcod = 100)
8. 29.515 29.515 ↑ 1.0 1 4,071 / 4

Index Scan using devedor_pkey on devedor d (cost=0.43..4.08 rows=1 width=22) (actual time=0.029..0.029 rows=1 loops=4,071)

  • Index Cond: ((carcod = 100) AND (devcod = c.devcod))
  • Filter: (devsal > '0'::numeric)
9. 3.000 774.000 ↑ 1.0 1 1,000

Limit (cost=8.62..8.62 rows=1 width=10) (actual time=0.773..0.774 rows=1 loops=1,000)

10. 14.000 771.000 ↑ 3.0 1 1,000

Sort (cost=8.62..8.63 rows=3 width=10) (actual time=0.771..0.771 rows=1 loops=1,000)

  • Sort Key: cp.conpardatven DESC
  • Sort Method: top-N heapsort Memory: 25kB
11. 757.000 757.000 ↓ 2.0 6 1,000

Index Scan using contrato_parcela_iu0023 on contrato_parcela cp (cost=0.56..8.60 rows=3 width=10) (actual time=0.364..0.757 rows=6 loops=1,000)

  • Index Cond: ((concod = c.concod) AND (conparati = 0) AND (conparvalsal > '0'::numeric))
12. 9.000 9.000 ↑ 1.0 1 1,000

Index Scan using carteira_situacao_iu0003 on carteira_situacao cs (cost=0.28..0.30 rows=1 width=25) (actual time=0.009..0.009 rows=1 loops=1,000)

  • Index Cond: ((sitcod = d.devsitcod) AND (carcod = 100))
13.          

SubPlan (for Nested Loop)

14. 6.000 10,712.000 ↑ 1.0 1 1,000

Aggregate (cost=1,842.03..1,842.04 rows=1 width=8) (actual time=10.712..10.712 rows=1 loops=1,000)

15. 10,706.000 10,706.000 ↑ 59.8 5 1,000

Index Scan using ret_car_dev_usu on retorno r (cost=0.57..1,841.28 rows=299 width=0) (actual time=5.047..10.706 rows=5 loops=1,000)

  • Index Cond: ((carcod = d.carcod) AND (devcod = d.devcod))
  • Filter: ((rettip = 0) AND (usucod <> ALL ('{7,43,10,15,9,21,777,37,74,3028,39,6300,1111,5,960,1986,1930,188,285,958,555,222,2018,2019,1987,9090,1996,1997,1992,39,1111,1117,780,2000,51,17}'::integer[])))
  • Rows Removed by Filter: 128
16. 2.000 364.000 ↑ 1.0 1 1,000

Limit (cost=0.57..6.82 rows=1 width=12) (actual time=0.364..0.364 rows=1 loops=1,000)

17. 362.000 362.000 ↑ 299.0 1 1,000

Index Scan Backward using retorno_iu0011 on retorno r_1 (cost=0.57..1,870.35 rows=299 width=12) (actual time=0.362..0.362 rows=1 loops=1,000)

  • Index Cond: ((devcod = d.devcod) AND (carcod = d.carcod))
  • Filter: ((rettip = 0) AND (usucod <> ALL ('{7,43,10,15,9,21,777,37,74,3028,39,6300,1111,5,960,1986,1930,188,285,958,555,222,2018,2019,1987,9090,1996,1997,1992,39,1111,1117,780,2000,51,17}'::integer[])))
  • Rows Removed by Filter: 51
18. 1.000 425.000 ↓ 0.0 0 1,000

Limit (cost=0.57..169.40 rows=1 width=20) (actual time=0.425..0.425 rows=0 loops=1,000)

19. 424.000 424.000 ↓ 0.0 0 1,000

Index Scan Backward using retorno_iu0001 on retorno r_2 (cost=0.57..1,857.70 rows=11 width=20) (actual time=0.424..0.424 rows=0 loops=1,000)

  • Index Cond: ((devcod = d.devcod) AND (carcod = d.carcod))
  • Filter: ((rettip = ANY ('{0,8}'::integer[])) AND (usucod <> ALL ('{1992,1996}'::integer[])) AND (sitcod = ANY ('{11,1054,1055,1056,1057,1062,1065,1067,1075,1350,1355,2001,2002,2004,2005,2031,2032,2033,2034,1360}'::integer[])))
  • Rows Removed by Filter: 87
Planning time : 3.776 ms
Execution time : 12,425.351 ms