explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qTyf

Settings
# exclusive inclusive rows x rows loops node
1. 15.336 1,250.401 ↓ 200.0 200 1

Limit (cost=1,001.73..429,083.68 rows=1 width=121) (actual time=26.354..1,250.401 rows=200 loops=1)

2. 2.956 1,235.065 ↓ 200.0 200 1

Nested Loop (cost=1,001.73..429,083.68 rows=1 width=121) (actual time=26.354..1,235.065 rows=200 loops=1)

3. 18.026 949.309 ↓ 200.0 200 1

Nested Loop (cost=1,001.46..427,065.00 rows=1 width=30) (actual time=25.707..949.309 rows=200 loops=1)

4. 220.715 403.083 ↓ 34.8 21,128 1

Gather Merge (cost=1,001.02..34,964.64 rows=608 width=32) (actual time=25.630..403.083 rows=21,128 loops=1)

  • Workers Planned: 3
  • Workers Launched: 3
5. 22.131 182.368 ↓ 30.9 6,055 4 / 4

Nested Loop (cost=0.98..33,893.16 rows=196 width=32) (actual time=0.123..182.368 rows=6,055 loops=4)

6. 63.357 63.357 ↓ 2.0 6,055 4 / 4

Parallel Index Scan using contrato_iu0010 on contrato c (cost=0.56..21,356.97 rows=3,075 width=22) (actual time=0.050..63.357 rows=6,055 loops=4)

  • Index Cond: ((carcod = 100) AND (conati = 0) AND (convalsal > '0'::numeric))
7. 96.880 96.880 ↑ 1.0 1 24,220 / 4

Index Scan using devedor_pkey on devedor d (cost=0.43..4.08 rows=1 width=22) (actual time=0.016..0.016 rows=1 loops=24,220)

  • Index Cond: ((carcod = 100) AND (devcod = c.devcod))
  • Filter: (devsal > '0'::numeric)
8. 491.318 528.200 ↓ 0.0 0 21,128

Index Scan using contrato_parcela_iu0021 on contrato_parcela p (cost=0.43..644.89 rows=1 width=14) (actual time=0.025..0.025 rows=0 loops=21,128)

  • Index Cond: (concod = c.concod)
  • Filter: (((CURRENT_DATE - conpardatven) >= 5) AND ((CURRENT_DATE - conpardatven) <= 360) AND (conparseq = (SubPlan 4)))
  • Rows Removed by Filter: 8
9.          

SubPlan (for Index Scan)

10. 2.732 36.882 ↑ 1.0 1 1,366

Limit (cost=8.60..8.61 rows=1 width=12) (actual time=0.026..0.027 rows=1 loops=1,366)

11. 10.928 34.150 ↑ 3.0 1 1,366

Sort (cost=8.60..8.61 rows=3 width=12) (actual time=0.025..0.025 rows=1 loops=1,366)

  • Sort Key: x.conpardatven
  • Sort Method: top-N heapsort Memory: 25kB
12. 23.222 23.222 ↓ 2.7 8 1,366

Index Scan using contrato_parcela_iu0023 on contrato_parcela x (cost=0.56..8.59 rows=3 width=12) (actual time=0.011..0.017 rows=8 loops=1,366)

  • Index Cond: ((concod = p.concod) AND (conparati = 0) AND (conparvalsal > '0'::numeric))
13. 1.400 1.400 ↑ 1.0 1 200

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

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

SubPlan (for Nested Loop)

15. 0.400 17.000 ↑ 1.0 1 200

Limit (cost=0.57..6.82 rows=1 width=12) (actual time=0.084..0.085 rows=1 loops=200)

16. 16.600 16.600 ↑ 299.0 1 200

Index Scan Backward using retorno_iu0011 on retorno r (cost=0.57..1,870.35 rows=299 width=12) (actual time=0.083..0.083 rows=1 loops=200)

  • 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: 35
17. 0.400 51.400 ↑ 1.0 1 200

Limit (cost=0.57..169.40 rows=1 width=20) (actual time=0.257..0.257 rows=1 loops=200)

18. 51.000 51.000 ↑ 11.0 1 200

Index Scan Backward using retorno_iu0001 on retorno r_1 (cost=0.57..1,857.70 rows=11 width=20) (actual time=0.255..0.255 rows=1 loops=200)

  • 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: 142
19. 2.400 213.000 ↑ 1.0 1 200

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

20. 210.600 210.600 ↑ 8.5 35 200

Index Scan using ret_car_dev_usu on retorno r_2 (cost=0.57..1,841.28 rows=299 width=0) (actual time=0.048..1.053 rows=35 loops=200)

  • 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: 585
Planning time : 5.677 ms
Execution time : 1,250.715 ms