explain.depesz.com

PostgreSQL's explain analyze made readable

Result: j84N

Settings
# exclusive inclusive rows x rows loops node
1. 655.896 9,424.106 ↑ 1.5 359,532 1

Hash Left Join (cost=116,878.43..168,364.54 rows=533,754 width=122) (actual time=8,628.521..9,424.106 rows=359,532 loops=1)

  • Hash Cond: ((sf_opp_his.id)::text = (sf_opp_his_lag.id)::text)
  • Filter: (((sf_opp_his.stage_name)::text <> (sf_opp_his_lag.stage_before)::text) OR (sf_opp_his_lag.stage_before IS NULL))
  • Rows Removed by Filter: 176891
2. 139.944 139.944 ↑ 1.0 536,423 1

Seq Scan on opportunity_history sf_opp_his (cost=0.00..17,622.23 rows=536,423 width=122) (actual time=0.007..139.944 rows=536,423 loops=1)

3. 227.394 8,628.266 ↑ 1.0 536,423 1

Hash (cost=104,934.15..104,934.15 rows=536,423 width=51) (actual time=8,628.265..8,628.266 rows=536,423 loops=1)

  • Buckets: 65536 Batches: 16 Memory Usage: 2471kB
4. 230.619 8,400.872 ↑ 1.0 536,423 1

Subquery Scan on sf_opp_his_lag (cost=88,841.46..104,934.15 rows=536,423 width=51) (actual time=5,662.465..8,400.872 rows=536,423 loops=1)

5. 474.701 8,170.253 ↑ 1.0 536,423 1

WindowAgg (cost=88,841.46..99,569.92 rows=536,423 width=78) (actual time=5,662.464..8,170.253 rows=536,423 loops=1)

6. 7,512.445 7,695.552 ↑ 1.0 536,423 1

Sort (cost=88,841.46..90,182.51 rows=536,423 width=57) (actual time=5,662.457..7,695.552 rows=536,423 loops=1)

  • Sort Key: opportunity_history.opportunity_id, opportunity_history.created_date
  • Sort Method: external merge Disk: 38128kB
7. 183.107 183.107 ↑ 1.0 536,423 1

Seq Scan on opportunity_history (cost=0.00..17,622.23 rows=536,423 width=57) (actual time=0.003..183.107 rows=536,423 loops=1)

Planning time : 0.378 ms
Execution time : 9,505.271 ms