explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ktQ

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 189.803 ↓ 0.0 0 1

Merge Right Join (cost=16,634.54..16,654.89 rows=1 width=45) (actual time=189.803..189.803 rows=0 loops=1)

  • Merge Cond: (p.application_user_id = o.application_user_id)
2.          

CTE o

3. 0.000 0.033 ↓ 0.0 0 1

GroupAggregate (cost=0.56..1.71 rows=1 width=16) (actual time=0.033..0.033 rows=0 loops=1)

  • Group Key: orders.application_user_id
4. 0.033 0.033 ↓ 0.0 0 1

Index Scan using orders_created_at_index on orders (cost=0.56..1.70 rows=1 width=12) (actual time=0.033..0.033 rows=0 loops=1)

  • Index Cond: (created_at >= (now() - '01:00:00'::interval))
  • Filter: (application_user_id = 34370585)
5. 0.001 189.759 ↑ 1,161.0 1 1

Unique (cost=16,630.14..16,635.96 rows=1,161 width=8) (actual time=189.759..189.759 rows=1 loops=1)

6. 27.033 189.758 ↑ 1,164.0 1 1

Sort (cost=16,630.14..16,633.05 rows=1,164 width=8) (actual time=189.758..189.758 rows=1 loops=1)

  • Sort Key: p.application_user_id
  • Sort Method: quicksort Memory: 7219kB
7. 162.725 162.725 ↓ 76.0 88,448 1

Seq Scan on primes p (cost=0.00..16,570.86 rows=1,164 width=8) (actual time=13.092..162.725 rows=88,448 loops=1)

  • Filter: (ends_at >= now())
  • Rows Removed by Filter: 409077
8. 0.007 0.042 ↓ 0.0 0 1

Sort (cost=2.69..2.69 rows=1 width=41) (actual time=0.042..0.042 rows=0 loops=1)

  • Sort Key: o.application_user_id
  • Sort Method: quicksort Memory: 25kB
9. 0.000 0.035 ↓ 0.0 0 1

Nested Loop (cost=0.43..2.68 rows=1 width=41) (actual time=0.035..0.035 rows=0 loops=1)

10. 0.035 0.035 ↓ 0.0 0 1

CTE Scan on o (cost=0.00..0.02 rows=1 width=16) (actual time=0.035..0.035 rows=0 loops=1)

11. 0.000 0.000 ↓ 0.0 0

Index Scan using application_users_pkey on application_users au (cost=0.43..2.65 rows=1 width=33) (never executed)

  • Index Cond: (id = o.application_user_id)
Planning time : 0.710 ms
Execution time : 190.317 ms