explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QKMN

Settings
# exclusive inclusive rows x rows loops node
1. 363.958 14,776.398 ↓ 4,297.2 55,863 1

Group (cost=506.73..506.89 rows=13 width=112) (actual time=12,493.632..14,776.398 rows=55,863 loops=1)

  • Group Key: utp.sf_usuario__c, ctp.sf_conta__c, tptp.sf_tipo_pedido__c, tp.sf_name
2. 11,470.119 14,412.440 ↓ 163,740.2 2,128,622 1

Sort (cost=506.73..506.76 rows=13 width=74) (actual time=12,493.627..14,412.440 rows=2,128,622 loops=1)

  • Sort Key: utp.sf_usuario__c, ctp.sf_conta__c, tptp.sf_tipo_pedido__c, tp.sf_name
  • Sort Method: external merge Disk: 157656kB
3. 274.067 2,942.321 ↓ 163,740.2 2,128,622 1

Hash Join (cost=41.81..506.49 rows=13 width=74) (actual time=282.417..2,942.321 rows=2,128,622 loops=1)

  • Hash Cond: (utp.sf_tabela_preco__c = ftp.sf_tabela_preco__c)
4. 440.296 2,668.002 ↓ 28,743.0 57,486 1

Nested Loop (cost=2.05..466.48 rows=2 width=163) (actual time=282.148..2,668.002 rows=57,486 loops=1)

  • Join Filter: (tptp.sf_tipo_pedido__c = tp.sf_id)
  • Rows Removed by Join Filter: 3980114
5. 0.236 0.236 ↑ 1.0 70 1

Seq Scan on sfa_sf_tipo_pedido__c tp (cost=0.00..3.70 rows=70 width=36) (actual time=0.014..0.236 rows=70 loops=1)

6. 535.757 2,227.470 ↓ 28,840.0 57,680 70

Materialize (cost=2.05..460.69 rows=2 width=146) (actual time=0.015..31.821 rows=57,680 loops=70)

7. 103.410 1,691.713 ↓ 28,840.0 57,680 1

Nested Loop (cost=2.05..460.68 rows=2 width=146) (actual time=0.713..1,691.713 rows=57,680 loops=1)

  • Join Filter: (utp.sf_tabela_preco__c = ctp.sf_tabela_preco__c)
  • Rows Removed by Join Filter: 156342
8. 43.496 127.887 ↓ 244.7 182,552 1

Nested Loop (cost=1.77..222.04 rows=746 width=127) (actual time=0.135..127.887 rows=182,552 loops=1)

9. 0.171 1.587 ↓ 23.3 163 1

Nested Loop (cost=1.35..114.27 rows=7 width=108) (actual time=0.109..1.587 rows=163 loops=1)

10. 0.290 0.901 ↓ 5.7 103 1

Hash Join (cost=1.21..111.02 rows=18 width=70) (actual time=0.094..0.901 rows=103 loops=1)

  • Hash Cond: (utp.sf_tabela_preco__c = pb.sf_id)
11. 0.593 0.593 ↓ 1.0 1,568 1

Seq Scan on sfa_sf_usuario_tabela_preco__c utp (cost=0.00..103.79 rows=1,557 width=38) (actual time=0.068..0.593 rows=1,568 loops=1)

  • Filter: (is_active AND (NOT is_deleted) AND (NOT sf_is_deleted) AND sf_ativo__c AND is_active AND (NOT is_deleted) AND (NOT sf_is_deleted) AND sf_ativo__c)
  • Rows Removed by Filter: 11
12. 0.003 0.018 ↓ 7.0 7 1

Hash (cost=1.20..1.20 rows=1 width=32) (actual time=0.018..0.018 rows=7 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
13. 0.015 0.015 ↓ 7.0 7 1

Seq Scan on sfa_sf_pricebook2 pb (cost=0.00..1.20 rows=1 width=32) (actual time=0.010..0.015 rows=7 loops=1)

  • Filter: (is_active AND (NOT is_deleted) AND (NOT sf_is_deleted) AND sf_is_active AND (CURRENT_DATE >= sf_data_validade_inicial__c) AND (CURRENT_DATE <= sf_data_validade_final__c))
  • Rows Removed by Filter: 3
14. 0.515 0.515 ↓ 2.0 2 103

Index Scan using idx_2_sfa_sf_tipo_pedido_tabela_preco__c on sfa_sf_tipo_pedido_tabela_preco__c tptp (cost=0.14..0.17 rows=1 width=38) (actual time=0.004..0.005 rows=2 loops=103)

  • Index Cond: (sf_tabela_preco__c = utp.sf_tabela_preco__c)
15. 82.804 82.804 ↓ 3.1 1,120 163

Index Scan using idx_2_sfa_account2 on sfa_account2 a (cost=0.41..11.73 rows=367 width=38) (actual time=0.011..0.508 rows=1,120 loops=163)

  • Index Cond: (user_id = utp.sf_usuario__c)
16. 1,460.416 1,460.416 ↑ 1.0 1 182,552

Index Only Scan using idx_5_sfa_sf_conta_tabela_preco__c on sfa_sf_conta_tabela_preco__c ctp (cost=0.28..0.31 rows=1 width=38) (actual time=0.008..0.008 rows=1 loops=182,552)

  • Index Cond: (sf_conta__c = a.sf_id)
  • Heap Fetches: 0
17. 0.064 0.252 ↑ 1.1 483 1

Hash (cost=33.24..33.24 rows=522 width=19) (actual time=0.251..0.252 rows=483 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 33kB
18. 0.188 0.188 ↑ 1.0 522 1

Seq Scan on sfa_sf_filial_tabela_preco__c ftp (cost=0.00..33.24 rows=522 width=19) (actual time=0.036..0.188 rows=522 loops=1)

  • Filter: (is_active AND (NOT is_deleted) AND (NOT sf_is_deleted) AND sf_ativo__c)
  • Rows Removed by Filter: 2
Planning time : 6.437 ms
Execution time : 14,815.251 ms