explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ajTj

Settings
# exclusive inclusive rows x rows loops node
1. 0.059 25.048 ↑ 27.1 154 1

Sort (cost=4,129.79..4,131.87 rows=4,168 width=174) (actual time=25.040..25.048 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.146 24.989 ↑ 27.1 154 1

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

  • Group Key: customer_profiles.id, real_estate_agents.id
3. 1.257 22.843 ↑ 1.9 2,174 1

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

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

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

5. 5.329 8.195 ↑ 2.0 2,068 1

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

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

7. 0.056 0.727 ↓ 1.2 154 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
8. 0.104 0.671 ↓ 1.2 154 1

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

9. 0.080 0.259 ↓ 1.2 154 1

Nested Loop (cost=0.06..89.19 rows=128 width=32) (actual time=0.016..0.259 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.921 ms
Execution time : 25.158 ms