explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.009 30,668.053 ↑ 1.0 4 1

Limit (cost=14,694.34..14,694.35 rows=4 width=1,127) (actual time=30,668.043..30,668.053 rows=4 loops=1)

2. 24.856 30,668.044 ↑ 5,661.8 4 1

Sort (cost=14,694.34..14,750.96 rows=22,647 width=1,127) (actual time=30,668.042..30,668.044 rows=4 loops=1)

  • Sort Key: news.news_top DESC, news.news_datetime DESC NULLS LAST
  • Sort Method: top-N heapsort Memory: 33kB
3. 19.247 30,643.188 ↓ 1.0 22,951 1

Hash Left Join (cost=9.09..14,354.64 rows=22,647 width=1,127) (actual time=0.230..30,643.188 rows=22,951 loops=1)

  • Hash Cond: (news.news_id = news_comments_count.news_id)
4. 30,623.733 30,623.733 ↓ 1.0 22,951 1

Seq Scan on news_view news (cost=0.00..14,286.10 rows=22,647 width=1,123) (actual time=0.017..30,623.733 rows=22,951 loops=1)

  • Filter: ((news_city_ids @> '{23}'::integer[]) OR (news_city_ids = '{}'::integer[]))
  • Rows Removed by Filter: 46989
5. 0.106 0.208 ↑ 1.0 315 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
6. 0.102 0.102 ↑ 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.006..0.102 rows=315 loops=1)