explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3ps : plan

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=18,940.10..18,940.10 rows=1 width=1,066) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Sort (cost=18,940.10..18,940.10 rows=1 width=1,066) (actual rows= loops=)

  • Sort Key: ae.visit_id DESC
3. 0.000 0.000 ↓ 0.0

Merge Join (cost=1,194.75..18,940.10 rows=1 width=1,066) (actual rows= loops=)

  • Merge Cond: (lr.representative_id = r.id)
4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1,002.12..26,352.49 rows=210 width=328) (actual rows= loops=)

  • Join Filter: ((lr.id)::text = (ae.properties ->> 'location_representative_id'::text))
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.12..460.97 rows=27 width=179) (actual rows= loops=)

  • Join Filter: (l.id = lr.location_id)
6. 0.000 0.000 ↓ 0.0

Index Scan using index_locations_representatives_on_representative_id on locations_representatives lr (cost=0.06..279.02 rows=8,480 width=12) (actual rows= loops=)

  • Filter: is_active
7. 0.000 0.000 ↓ 0.0

Materialize (cost=2.06..12.35 rows=5 width=171) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.06..12.34 rows=5 width=171) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..2.09 rows=1 width=60) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Seq Scan on organizations o (cost=0.00..1.04 rows=1 width=43) (actual rows= loops=)

  • Filter: (id = 44)
11. 0.000 0.000 ↓ 0.0

Seq Scan on bizcard_settings s (cost=0.00..1.04 rows=1 width=21) (actual rows= loops=)

  • Filter: (organization_id = 44)
12. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on locations l (cost=2.06..10.24 rows=5 width=111) (actual rows= loops=)

  • Recheck Cond: (organization_id = 44)
  • Filter: is_active
13. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on index_locations_on_organization_id (cost=0.00..2.06 rows=5 width=0) (actual rows= loops=)

  • Index Cond: (organization_id = 44)
14. 0.000 0.000 ↓ 0.0

Materialize (cost=1,000.00..25,663.45 rows=1,541 width=153) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Gather (cost=1,000.00..25,661.91 rows=1,541 width=153) (actual rows= loops=)

  • Workers Planned: 1
16. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on ahoy_events ae (cost=0.00..24,507.81 rows=906 width=153) (actual rows= loops=)

  • Filter: (((name)::text = 'bizcard_install'::text) AND ((properties ->> 'organization_id'::text) = '44'::text))
17. 0.000 0.000 ↓ 0.0

Sort (cost=192.63..192.63 rows=12 width=59) (actual rows= loops=)

  • Sort Key: r.id
18. 0.000 0.000 ↓ 0.0

Seq Scan on representatives r (cost=0.00..192.58 rows=12 width=59) (actual rows= loops=)

  • Filter: (is_active AND (organization_id = 44))