explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MYLK

Settings
# exclusive inclusive rows x rows loops node
1. 0.062 32.419 ↑ 20.6 131 1

Sort (cost=4,093.67..4,095.02 rows=2,702 width=178) (actual time=32.411..32.419 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.439 32.357 ↑ 20.6 131 1

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

  • Group Key: customer_profiles.id, real_estate_agents.id
3. 2.758 27.918 ↓ 1.4 3,705 1

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

  • Sort Key: customer_profiles.id, real_estate_agents.id
  • Sort Method: quicksort Memory: 2006kB
4. 2.459 25.160 ↓ 1.4 3,705 1

Nested Loop Left Join (cost=425.53..3,998.29 rows=2,702 width=379) (actual time=0.757..25.160 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: 8593
5. 5.340 8.225 ↑ 2.0 2,068 1

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

  • Hash Cond: (agent_clients.customer_profile_id = sponsorships.real_estate_agent_id)
6. 2.159 2.159 ↓ 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.005..2.159 rows=14,544 loops=1)

7. 0.063 0.726 ↓ 1.2 154 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 30kB
8. 0.090 0.663 ↓ 1.2 154 1

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

9. 0.087 0.265 ↓ 1.2 154 1

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

10. 0.024 0.024 ↓ 1.2 154 1

Seq Scan on sponsorships (cost=0.00..3.38 rows=128 width=32) (actual time=0.008..0.024 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.914 ms
Execution time : 32.635 ms