explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VyCI

Settings
# exclusive inclusive rows x rows loops node
1. 0.051 32.242 ↑ 20.6 131 1

Sort (cost=4,093.67..4,095.02 rows=2,702 width=178) (actual time=32.236..32.242 rows=131 loops=1)

  • Sort Key: (count(ce.*) FILTER (WHERE (ce.created_at >= (now() - '7 days'::interval)))) DESC
  • Sort Method: quicksort Memory: 52kB
2. 4.420 32.191 ↑ 20.6 131 1

GroupAggregate (cost=4,029.09..4,062.86 rows=2,702 width=178) (actual time=27.602..32.191 rows=131 loops=1)

  • Group Key: customer_profiles.id, real_estate_agents.id
3. 2.586 27.771 ↓ 1.4 3,705 1

Sort (cost=4,029.09..4,030.44 rows=2,702 width=379) (actual time=27.572..27.771 rows=3,705 loops=1)

  • Sort Key: customer_profiles.id, real_estate_agents.id
  • Sort Method: quicksort Memory: 2,006kB
4. 2.488 25.185 ↓ 1.4 3,705 1

Nested Loop Left Join (cost=425.53..3,998.29 rows=2,702 width=379) (actual time=0.773..25.185 rows=3,705 loops=1)

  • Filter: (((ce.source)::text = ANY ('{home-digest,buyer-digest,customer,ylopo}'::text[])) OR (ce.id IS NULL))
  • Rows Removed by Filter: 8,593
5. 5.339 8.221 ↑ 2.0 2,068 1

Hash Right Join (cost=425.45..1,960.57 rows=4,168 width=170) (actual time=0.759..8.221 rows=2,068 loops=1)

  • Hash Cond: (agent_clients.customer_profile_id = sponsorships.real_estate_agent_id)
6. 2.134 2.134 ↓ 1.0 14,544 1

Seq Scan on clients agent_clients (cost=0.00..1,508.21 rows=14,403 width=40) (actual time=0.004..2.134 rows=14,544 loops=1)

7. 0.053 0.748 ↓ 1.2 154 1

Hash (cost=425.00..425.00 rows=128 width=162) (actual time=0.748..0.748 rows=154 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 30kB
8. 0.125 0.695 ↓ 1.2 154 1

Nested Loop (cost=0.11..425.00 rows=128 width=162) (actual time=0.024..0.695 rows=154 loops=1)

9. 0.083 0.262 ↓ 1.2 154 1

Nested Loop (cost=0.06..89.19 rows=128 width=32) (actual time=0.016..0.262 rows=154 loops=1)

10. 0.025 0.025 ↓ 1.2 154 1

Seq Scan on sponsorships (cost=0.00..3.38 rows=128 width=32) (actual time=0.008..0.025 rows=154 loops=1)

11. 0.154 0.154 ↑ 1.0 1 154

Index Only Scan using legacy_agents_pkey on customer_profiles (cost=0.06..0.67 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=154)

  • Index Cond: (id = sponsorships.loan_officer_id)
  • Heap Fetches: 10
12. 0.308 0.308 ↑ 1.0 1 154

Index Scan using legacy_agents_pkey on customer_profiles real_estate_agents (cost=0.06..2.62 rows=1 width=130) (actual time=0.002..0.002 rows=1 loops=154)

  • Index Cond: (id = sponsorships.real_estate_agent_id)
13. 14.476 14.476 ↓ 1.2 6 2,068

Index Scan using index_client_events_on_client_id on client_events ce (cost=0.08..0.47 rows=5 width=248) (actual time=0.003..0.007 rows=6 loops=2,068)

  • Index Cond: (agent_clients.id = client_id)
Planning time : 0.908 ms
Execution time : 32.355 ms