explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Mreh : tag show video with partial index

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.011 314.075 ↑ 1.0 51 1

Limit (cost=1,619.17..1,619.30 rows=51 width=1,521) (actual time=314.060..314.075 rows=51 loops=1)

2. 1.410 314.064 ↑ 2.8 51 1

Sort (cost=1,619.17..1,619.53 rows=142 width=1,521) (actual time=314.059..314.064 rows=51 loops=1)

  • Sort Key: videos.publish_date DESC
  • Sort Method: top-N heapsort Memory: 108kB
3. 1.219 312.654 ↓ 3.3 463 1

Nested Loop (cost=397.80..1,614.43 rows=142 width=1,521) (actual time=126.389..312.654 rows=463 loops=1)

4. 1.069 126.305 ↑ 1.0 510 1

HashAggregate (cost=397.38..402.48 rows=510 width=4) (actual time=125.910..126.305 rows=510 loops=1)

  • Group Key: taggings.taggable_id
5. 0.130 125.236 ↑ 1.0 510 1

Limit (cost=0.43..391.00 rows=510 width=12) (actual time=0.961..125.236 rows=510 loops=1)

6. 125.106 125.106 ↑ 21.8 510 1

Index Scan Backward using index_taggings_on_tag_id_and_taggable_type_and_created_at on taggings (cost=0.43..8,506.52 rows=11,107 width=12) (actual time=0.961..125.106 rows=510 loops=1)

  • Index Cond: ((tag_id = 1,719) AND ((taggable_type)::text = 'Video'::text))
7. 185.130 185.130 ↑ 1.0 1 510

Index Scan using index_videos_on_id_and_publish_date on videos (cost=0.42..2.38 rows=1 width=1,521) (actual time=0.363..0.363 rows=1 loops=510)

  • Index Cond: ((id = taggings.taggable_id) AND (publish_date <= '2020-02-04 03:59:59.999999'::timestamp without time zone))
Planning time : 3.590 ms
Execution time : 314.294 ms