explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9LMX

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 252.838 ↓ 0.0 0 1

Insert on prices (cost=4,079.94..231,257.41 rows=1 width=44) (actual time=252.838..252.838 rows=0 loops=1)

2. 0.000 252.836 ↓ 0.0 0 1

Subquery Scan on *SELECT* (cost=4,079.94..231,257.41 rows=1 width=44) (actual time=252.836..252.836 rows=0 loops=1)

3. 7.667 252.836 ↓ 0.0 0 1

Hash Join (cost=4,079.94..231,257.40 rows=1 width=36) (actual time=252.835..252.836 rows=0 loops=1)

  • Hash Cond: ((new_prices.advert_id = prices_1.advert_id) AND ((SubPlan 2) = prices_1.created))
  • Join Filter: ((new_prices.new_price <> prices_1.price) OR (prices_1.price IS NULL))
  • Rows Removed by Join Filter: 13
4.          

CTE new_prices

5. 0.034 0.034 ↑ 1.0 13 1

Values Scan on *VALUES* (cost=0.00..0.16 rows=13 width=36) (actual time=0.003..0.034 rows=13 loops=1)

6. 0.064 0.064 ↑ 1.0 13 1

CTE Scan on new_prices (cost=0.00..0.26 rows=13 width=36) (actual time=0.006..0.064 rows=13 loops=1)

7. 34.522 46.283 ↑ 1.0 96,430 1

Hash (cost=1,932.11..1,932.11 rows=98,311 width=28) (actual time=46.283..46.283 rows=96,430 loops=1)

  • Buckets: 65536 Batches: 2 Memory Usage: 3341kB
8. 11.761 11.761 ↑ 1.0 96,430 1

Seq Scan on prices prices_1 (cost=0.00..1,932.11 rows=98,311 width=28) (actual time=0.038..11.761 rows=96,430 loops=1)

9.          

SubPlan (for Hash Join)

10. 0.130 198.822 ↑ 1.0 1 26

Aggregate (cost=2,177.89..2,177.90 rows=1 width=8) (actual time=7.647..7.647 rows=1 loops=26)

11. 198.692 198.692 ↑ 1.0 1 26

Seq Scan on prices prices_2 (cost=0.00..2,177.89 rows=1 width=8) (actual time=2.486..7.642 rows=1 loops=26)

  • Filter: (advert_id = new_prices.advert_id)
  • Rows Removed by Filter: 96429
Planning time : 4.181 ms
Execution time : 257.109 ms