explain.depesz.com

PostgreSQL's explain analyze made readable

Result: N4nK : tag show with limit 510

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.009 173.270 ↑ 1.0 51 1

Limit (cost=1,646.45..1,646.57 rows=51 width=1,521) (actual time=173.257..173.270 rows=51 loops=1)

2. 1.021 173.261 ↑ 2.8 51 1

Sort (cost=1,646.45..1,646.80 rows=142 width=1,521) (actual time=173.255..173.261 rows=51 loops=1)

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

Nested Loop (cost=397.81..1,641.71 rows=142 width=1,521) (actual time=3.791..172.240 rows=463 loops=1)

4. 0.411 3.095 ↑ 1.0 510 1

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

  • Group Key: taggings.taggable_id
5. 0.054 2.684 ↑ 1.0 510 1

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

6. 2.630 2.630 ↑ 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.051..2.630 rows=510 loops=1)

  • Index Cond: ((tag_id = 1719) AND ((taggable_type)::text = 'Video'::text))
7. 168.300 168.300 ↑ 1.0 1 510

Index Scan using videos_pkey on videos (cost=0.43..2.43 rows=1 width=1,521) (actual time=0.330..0.330 rows=1 loops=510)

  • Index Cond: (id = taggings.taggable_id)
  • Filter: ((NOT deleted) AND (NOT private) AND published AND (publish_date <= '2020-02-04 03:59:59.999999'::timestamp without time zone))
  • Rows Removed by Filter: 0
Planning time : 2.623 ms
Execution time : 173.458 ms