explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3PtI

Settings
# exclusive inclusive rows x rows loops node
1. 4.398 11.087 ↓ 86.4 9,328 1

Sort (cost=129.17..129.44 rows=108 width=20) (actual time=9.800..11.087 rows=9,328 loops=1)

  • Sort Key: c.data_inicio
  • Sort Method: quicksort Memory: 1113kB
2. 3.411 6.689 ↓ 86.4 9,328 1

Nested Loop (cost=1.42..125.52 rows=108 width=20) (actual time=0.121..6.689 rows=9,328 loops=1)

3. 0.035 0.286 ↓ 2.6 44 1

Nested Loop (cost=1.12..114.40 rows=17 width=36) (actual time=0.095..0.286 rows=44 loops=1)

4. 0.013 0.141 ↓ 1.5 22 1

Nested Loop (cost=0.71..106.94 rows=15 width=40) (actual time=0.084..0.141 rows=22 loops=1)

5. 0.086 0.086 ↓ 3.0 3 1

Index Scan using contrato_test_1 on contrato c (cost=0.29..90.28 rows=1 width=24) (actual time=0.073..0.086 rows=3 loops=1)

  • Index Cond: (empresa_id = 1615)
  • Filter: ((data_inicio <= CURRENT_DATE) AND (data_inicio >= (CURRENT_DATE - 90)))
  • Rows Removed by Filter: 36
6. 0.042 0.042 ↑ 3.4 7 3

Index Scan using item_contrato_test_2 on item_contrato ic (cost=0.42..16.41 rows=24 width=16) (actual time=0.010..0.014 rows=7 loops=3)

  • Index Cond: (contrato_id = c.id)
7. 0.110 0.110 ↓ 2.0 2 22

Index Scan using parcelamento_item_contrato_test_1 on parcelamento_item_contrato pic (cost=0.42..0.49 rows=1 width=12) (actual time=0.004..0.005 rows=2 loops=22)

  • Index Cond: (item_contrato = ic.id)
8. 2.992 2.992 ↓ 16.3 212 44

Index Only Scan using contrato_loja_test_2 on contrato_loja lc (cost=0.29..0.52 rows=13 width=8) (actual time=0.015..0.068 rows=212 loops=44)

  • Index Cond: (contrato_id = ic.contrato_id)
  • Heap Fetches: 0
Planning time : 1.488 ms
Execution time : 12.293 ms