explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CZkp : Optimization for: plan #7wRR

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.011 72,573.195 ↑ 1.0 4 1

Limit (cost=14,736.19..14,736.20 rows=4 width=1,127) (actual time=72,573.185..72,573.195 rows=4 loops=1)

2. 32.742 72,573.184 ↑ 5,661.8 4 1

Sort (cost=14,736.19..14,792.81 rows=22,647 width=1,127) (actual time=72,573.183..72,573.184 rows=4 loops=1)

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

Hash Left Join (cost=239.94..14,396.49 rows=22,647 width=1,127) (actual time=34.213..72,540.442 rows=22,951 loops=1)

  • Hash Cond: (news.news_id = news_comments_count.news_id)
4. 72,510.370 72,512.501 ↓ 1.0 22,951 1

Bitmap Heap Scan on news_view news (cost=230.85..14,327.95 rows=22,647 width=1,123) (actual time=33.975..72,512.501 rows=22,951 loops=1)

  • Recheck Cond: ((news_city_ids @> '{23}'::integer[]) OR (news_city_ids = '{}'::integer[]))
  • Filter: (news_datetime <= now())
  • Heap Blocks: exact=7182
5. 0.001 2.131 ↓ 0.0 0 1

BitmapOr (cost=230.85..230.85 rows=22,870 width=0) (actual time=2.131..2.131 rows=0 loops=1)

6. 2.054 2.054 ↓ 1.0 22,184 1

Bitmap Index Scan on news_view_k_city (cost=0.00..206.23 rows=22,164 width=0) (actual time=2.053..2.054 rows=22,184 loops=1)

  • Index Cond: (news_city_ids @> '{23}'::integer[])
7. 0.076 0.076 ↓ 1.1 767 1

Bitmap Index Scan on news_view_k_city (cost=0.00..13.30 rows=706 width=0) (actual time=0.076..0.076 rows=767 loops=1)

  • Index Cond: (news_city_ids = '{}'::integer[])
8. 0.110 0.224 ↑ 1.0 315 1

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

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