explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cOo3

Settings
# exclusive inclusive rows x rows loops node
1. 59.463 1,147.223 ↑ 2.8 6,613 1

Index Scan using stock_price_company_id on stock_price t1 (cost=0.43..4,848,995.65 rows=18,707 width=36) (actual time=1.124..1,147.223 rows=6,613 loops=1)

  • Index Cond: (company_id < 10)
  • Filter: ((SubPlan 1) > 0)
  • Rows Removed by Filter: 47775
2.          

SubPlan (forIndex Scan)

3. 0.000 1,087.760 ↑ 1.0 1 54,388

Aggregate (cost=84.16..84.17 rows=1 width=8) (actual time=0.020..0.020 rows=1 loops=54,388)

4. 1,087.760 1,087.760 ↑ 8.0 1 54,388

Index Scan using stock_price_company_id_and_date on stock_price t2 (cost=0.44..84.14 rows=8 width=0) (actual time=0.018..0.020 rows=1 loops=54,388)

  • Index Cond: ((t1.company_id = company_id) AND (date < t1.date) AND (date > (t1.date - '1 mon'::interval)))
  • Filter: (((t1.end_price)::numeric / 1.2) > (end_price)::numeric)
  • Rows Removed by Filter: 27
Planning time : 0.592 ms
Execution time : 1,147.829 ms