explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gttk

Settings
# exclusive inclusive rows x rows loops node
1. 0.397 13.373 ↓ 903.0 903 1

Nested Loop (cost=8,457.36..8,496.10 rows=1 width=147) (actual time=7.915..13.373 rows=903 loops=1)

  • Output: article.id, alert.title, alert.published_at, 'alert'::text
  • Inner Unique: true
2. 0.619 2.140 ↓ 903.0 903 1

Merge Join (cost=81.46..119.79 rows=1 width=119) (actual time=1.147..2.140 rows=903 loops=1)

  • Output: alert.title, alert.published_at, alert.article_id, alert_1.article_id
  • Inner Unique: true
  • Merge Cond: (alert.published_at = (max(alert_1.published_at)))
  • Join Filter: (alert.article_id = alert_1.article_id)
  • Rows Removed by Join Filter: 171
3. 0.273 0.273 ↑ 1.0 926 1

Index Scan Backward using alert_published_at_index on public.alert (cost=0.28..20.18 rows=926 width=115) (actual time=0.019..0.273 rows=926 loops=1)

  • Output: alert.id, alert.created_at, alert.updated_at, alert.title, alert.content, alert.thematic, alert.article_id, alert.published_at
4. 0.366 1.248 ↓ 1.2 1,056 1

Sort (cost=81.18..83.44 rows=903 width=12) (actual time=1.122..1.248 rows=1,056 loops=1)

  • Output: alert_1.article_id, (max(alert_1.published_at))
  • Sort Key: (max(alert_1.published_at)) DESC
  • Sort Method: quicksort Memory: 67kB
5. 0.598 0.882 ↑ 1.0 903 1

HashAggregate (cost=18.79..27.82 rows=903 width=12) (actual time=0.719..0.882 rows=903 loops=1)

  • Output: alert_1.article_id, max(alert_1.published_at)
  • Group Key: alert_1.article_id
6. 0.284 0.284 ↑ 1.0 926 1

Seq Scan on public.alert alert_1 (cost=0.00..14.16 rows=926 width=12) (actual time=0.014..0.284 rows=926 loops=1)

  • Output: alert_1.id, alert_1.created_at, alert_1.updated_at, alert_1.title, alert_1.content, alert_1.thematic, alert_1.article_id, alert_1.published_at
7. 5.012 10.836 ↑ 1.0 1 903

Index Scan using article_pkey on public.article (cost=8,375.90..8,376.32 rows=1 width=4) (actual time=0.012..0.012 rows=1 loops=903)

  • Output: article.id
  • Index Cond: (article.id = alert.article_id)
  • Filter: ((article.publication_url IS NOT NULL) AND (article.web_hidden IS FALSE) AND ((article.publication_url)::text <> ''::text) AND (NOT (hashed SubPlan 1)))
8.          

SubPlan (forIndex Scan)

9. 0.096 5.824 ↑ 18.6 850 1

Nested Loop (cost=1.14..8,336.03 rows=15,776 width=4) (actual time=0.160..5.824 rows=850 loops=1)

  • Output: article_1.id
  • Inner Unique: true
10. 0.166 2.328 ↑ 18.6 850 1

Nested Loop (cost=0.71..1,056.18 rows=15,776 width=4) (actual time=0.135..2.328 rows=850 loops=1)

  • Output: article_tag.article_id
  • Join Filter: (tag.id = article_tag.tag_id)
11. 0.091 0.411 ↓ 14.7 103 1

Nested Loop (cost=0.28..58.46 rows=7 width=8) (actual time=0.112..0.411 rows=103 loops=1)

  • Output: tag.id, brand_campaign.section_id
  • Inner Unique: true
12. 0.046 0.046 ↓ 1.0 137 1

Seq Scan on public.brand_campaign (cost=0.00..2.12 rows=132 width=4) (actual time=0.009..0.046 rows=137 loops=1)

  • Output: brand_campaign.id, brand_campaign.created_at, brand_campaign.updated_at, brand_campaign.title, brand_campaign.slug, brand_campaign.partner_id, bran
13. 0.274 0.274 ↑ 1.0 1 137

Index Scan using tag_pkey on public.tag (cost=0.28..0.43 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=137)

  • Output: tag.id, tag.created_at, tag.updated_at, tag.legacy_id, tag.type, tag.front_type, tag.title, tag.path, tag.url, tag.description, tag.followed, tag.h
  • Index Cond: (tag.id = brand_campaign.section_id)
  • Filter: (tag.brand_id IS NOT NULL)
  • Rows Removed by Filter: 0
14. 1.751 1.751 ↑ 389.5 8 103

Index Scan using article_tag_tag_id_index on public.article_tag (cost=0.43..103.58 rows=3,116 width=8) (actual time=0.005..0.017 rows=8 loops=103)

  • Output: article_tag.article_id, article_tag.tag_id, article_tag.created_at, article_tag.updated_at, article_tag.rank
  • Index Cond: (article_tag.tag_id = brand_campaign.section_id)
15. 3.400 3.400 ↑ 1.0 1 850

Index Only Scan using article_pkey on public.article article_1 (cost=0.43..0.46 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=850)

  • Output: article_1.id
  • Index Cond: (article_1.id = article_tag.article_id)
  • Heap Fetches: 392