explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GO27

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 72.432 ↑ 1.1 20 1

Append (cost=16,465.30..32,998.23 rows=21 width=296) (actual time=72.409..72.432 rows=20 loops=1)

2. 0.000 0.001 ↓ 0.0 0 1

Subquery Scan on tb_stock_cache (cost=16,465.30..16,465.32 rows=1 width=296) (actual time=0.001..0.001 rows=0 loops=1)

3. 0.001 0.001 ↓ 0.0 0 1

Limit (cost=16,465.30..16,465.31 rows=1 width=304) (actual time=0.001..0.001 rows=0 loops=1)

4. 0.000 0.000 ↓ 0.0 0

Sort (cost=16,465.30..16,465.31 rows=1 width=304) (never executed)

  • Sort Key: (length(tb_stock_cache_2.cd_stock)), (CASE WHEN (tb_stock_cache_2.cd_stock ~~ 'PETR%'::text) THEN 0 ELSE 1 END), (CASE WHEN ((tb_stock_cache_2.nm_company_valemobi)::text ~~* 'PETR%'::text) THEN 0 ELSE 1 END)
5. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on tb_stock_cache tb_stock_cache_2 (cost=692.43..16,465.29 rows=1 width=304) (never executed)

  • Recheck Cond: (cd_status_stock <> 'I'::text)
  • Filter: ((cd_segment = '90'::text) AND ((cd_stock ~~ 'PETR%'::text) OR ((nm_company_valemobi)::text ~~* 'PETR%'::text)))
6. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on tb_stock_cache2_cd_stock_idx2 (cost=0.00..692.42 rows=36,093 width=0) (never executed)

7. 0.019 72.427 ↑ 1.0 20 1

Subquery Scan on tb_stock_cache_1 (cost=16,532.56..16,532.81 rows=20 width=296) (actual time=72.407..72.427 rows=20 loops=1)

8. 0.004 72.408 ↑ 1.0 20 1

Limit (cost=16,532.56..16,532.61 rows=20 width=304) (actual time=72.403..72.408 rows=20 loops=1)

9. 2.270 72.404 ↑ 97.9 20 1

Sort (cost=16,532.56..16,537.46 rows=1,958 width=304) (actual time=72.402..72.404 rows=20 loops=1)

  • Sort Key: (length(tb_stock_cache_3.cd_stock)), tb_stock_cache_3.cd_segment, (CASE WHEN (tb_stock_cache_3.cd_stock ~~ 'PETR%'::text) THEN 0 ELSE 1 END), (CASE WHEN ((tb_stock_cache_3.nm_company_valemobi)::text ~~* 'PETR%'::text) THEN 0 ELSE 1 END)
  • Sort Method: top-N heapsort Memory: 37kB
10. 66.145 70.134 ↑ 1.1 1,812 1

Bitmap Heap Scan on tb_stock_cache tb_stock_cache_3 (cost=692.91..16,480.46 rows=1,958 width=304) (actual time=5.422..70.134 rows=1,812 loops=1)

  • Recheck Cond: (cd_status_stock <> 'I'::text)
  • Filter: ((cd_segment <> '90'::text) AND ((cd_stock ~~ 'PETR%'::text) OR ((nm_company_valemobi)::text ~~* 'PETR%'::text)))
  • Rows Removed by Filter: 34215
  • Heap Blocks: exact=6164
11. 3.989 3.989 ↑ 1.0 36,027 1

Bitmap Index Scan on tb_stock_cache2_cd_stock_idx2 (cost=0.00..692.42 rows=36,093 width=0) (actual time=3.989..3.989 rows=36,027 loops=1)

Planning time : 2.970 ms
Execution time : 72.757 ms