explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hQW7 : Optimization for: Optimization for: Optimization for: plan #7wRR; plan #CZkp; plan #RHei

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.008 94,351.664 ↑ 1.0 4 1

Limit (cost=14,510.98..14,510.99 rows=4 width=1,127) (actual time=94,351.656..94,351.664 rows=4 loops=1)

2. 31.253 94,351.656 ↑ 5,541.0 4 1

Sort (cost=14,510.98..14,566.39 rows=22,164 width=1,127) (actual time=94,351.655..94,351.656 rows=4 loops=1)

  • Sort Key: news.news_top DESC, news.news_datetime DESC NULLS LAST
  • Sort Method: top-N heapsort Memory: 33kB
3. 26.650 94,320.403 ↓ 1.0 22,184 1

Hash Left Join (cost=9.09..14,178.52 rows=22,164 width=1,127) (actual time=34.818..94,320.403 rows=22,184 loops=1)

  • Hash Cond: (news.news_id = news_comments_count.news_id)
4. 94,293.489 94,293.489 ↓ 1.0 22,184 1

Seq Scan on news_view news (cost=0.00..14,111.25 rows=22,164 width=1,123) (actual time=34.544..94,293.489 rows=22,184 loops=1)

  • Filter: (news_city_ids @> '{23}'::integer[])
  • Rows Removed by Filter: 47756
5. 0.136 0.264 ↑ 1.0 315 1

Hash (cost=5.15..5.15 rows=315 width=8) (actual time=0.263..0.264 rows=315 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
6. 0.128 0.128 ↑ 1.0 315 1

Seq Scan on comments_news_count news_comments_count (cost=0.00..5.15 rows=315 width=8) (actual time=0.011..0.128 rows=315 loops=1)

Planning time : 652.123 ms
Execution time : 94,351.729 ms