explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3lY7

Settings
# exclusive inclusive rows x rows loops node
1. 0.058 25.096 ↑ 27.1 154 1

Sort (cost=4,129.79..4,131.87 rows=4,168 width=174) (actual time=25.089..25.096 rows=154 loops=1)

  • Sort Key: (count(ce.*) FILTER (WHERE (ce.created_at >= (now() - '7 days'::interval)))) DESC
  • Sort Method: quicksort Memory: 55kB
2. 2.167 25.038 ↑ 27.1 154 1

GroupAggregate (cost=4,029.65..4,079.67 rows=4,168 width=174) (actual time=22.757..25.038 rows=154 loops=1)

  • Group Key: customer_profiles.id, real_estate_agents.id
3. 1.453 22.871 ↑ 1.9 2,174 1

Sort (cost=4,029.65..4,031.73 rows=4,168 width=383) (actual time=22.731..22.871 rows=2,174 loops=1)

  • Sort Key: customer_profiles.id, real_estate_agents.id
  • Sort Method: quicksort Memory: 565kB
4. 0.747 21.418 ↑ 1.9 2,174 1

Nested Loop Left Join (cost=425.53..3,979.53 rows=4,168 width=383) (actual time=0.794..21.418 rows=2,174 loops=1)

5. 5.355 8.263 ↑ 2.0 2,068 1

Hash Right Join (cost=425.45..1,960.57 rows=4,168 width=174) (actual time=0.755..8.263 rows=2,068 loops=1)

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

7. 0.056 0.744 ↓ 1.2 154 1

Hash (cost=425.00..425.00 rows=128 width=166) (actual time=0.744..0.744 rows=154 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
8. 0.115 0.688 ↓ 1.2 154 1

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

9. 0.086 0.265 ↓ 1.2 154 1

Nested Loop (cost=0.06..89.19 rows=128 width=32) (actual time=0.016..0.265 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=134) (actual time=0.002..0.002 rows=1 loops=154)

  • Index Cond: (id = sponsorships.real_estate_agent_id)
13. 12.408 12.408 ↓ 0.0 0 2,068

Index Scan using index_client_events_on_client_id on client_events ce (cost=0.08..0.48 rows=1 width=225) (actual time=0.006..0.006 rows=0 loops=2,068)

  • Index Cond: (agent_clients.id = client_id)
  • Filter: ((((source)::text = ANY ('{home-digest,buyer-digest,customer,ylopo}'::text[])) AND (created_at >= (now() - '14 days'::interval))) OR (id IS NULL))
  • Rows Removed by Filter: 6
Planning time : 0.978 ms
Execution time : 25.209 ms