explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dIcR

Settings
# exclusive inclusive rows x rows loops node
1. 5,756.624 5,756.649 ↑ 2,370,972.5 2 1

Seq Scan on items (cost=7.95..786,227.07 rows=4,741,945 width=1,107) (actual time=2,221.058..5,756.649 rows=2 loops=1)

  • Filter: (((type)::text = 'Message'::text) AND CASE WHEN ((author_type)::text = 'SocialProfile'::text) THEN (hashed SubPlan 1) WHEN ((author_type)::text = 'ClientUser'::text) THEN (hashed SubPlan 2) ELSE false END)
  • Rows Removed by Filter: 10,876,609
2.          

SubPlan (for Seq Scan)

3. 0.000 0.024 ↑ 1.0 1 1

Nested Loop Semi Join (cost=0.85..5.30 rows=1 width=4) (actual time=0.023..0.024 rows=1 loops=1)

4. 0.015 0.015 ↑ 1.0 1 1

Index Scan using index_social_profiles_on_client_user_id on social_profiles (cost=0.43..2.65 rows=1 width=8) (actual time=0.014..0.015 rows=1 loops=1)

  • Index Cond: (client_user_id = 1,345,144)
5. 0.009 0.009 ↑ 1.0 1 1

Index Only Scan using client_users_pkey on client_users (cost=0.43..2.65 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=1)

  • Index Cond: (id = 1,345,144)
  • Heap Fetches: 0
6. 0.001 0.001 ↑ 1.0 1 1

Index Only Scan using client_users_pkey on client_users client_users_1 (cost=0.43..2.65 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

  • Index Cond: (id = 1,345,144)
  • Heap Fetches: 0