explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MlW9

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 0.049 ↑ 1.0 1 1

Aggregate (cost=31.21..31.22 rows=1 width=32) (actual time=0.049..0.049 rows=1 loops=1)

2. 0.001 0.047 ↓ 0.0 0 1

GroupAggregate (cost=31.17..31.19 rows=1 width=40) (actual time=0.047..0.047 rows=0 loops=1)

  • Group Key: fl.days_to_expiry
3. 0.002 0.046 ↓ 0.0 0 1

Sort (cost=31.17..31.17 rows=1 width=175) (actual time=0.046..0.046 rows=0 loops=1)

  • Sort Key: fl.days_to_expiry
  • Sort Method: quicksort Memory: 25kB
4. 0.001 0.044 ↓ 0.0 0 1

Subquery Scan on fl (cost=31.11..31.16 rows=1 width=175) (actual time=0.044..0.044 rows=0 loops=1)

  • Filter: (fl.row_counter = 1)
5. 0.000 0.043 ↓ 0.0 0 1

WindowAgg (cost=31.11..31.14 rows=1 width=191) (actual time=0.043..0.043 rows=0 loops=1)

6. 0.005 0.043 ↓ 0.0 0 1

Sort (cost=31.11..31.12 rows=1 width=175) (actual time=0.043..0.043 rows=0 loops=1)

  • Sort Key: udt.device_token, s.expiry
  • Sort Method: quicksort Memory: 25kB
7. 0.001 0.038 ↓ 0.0 0 1

Nested Loop (cost=21.98..31.10 rows=1 width=175) (actual time=0.038..0.038 rows=0 loops=1)

8. 0.006 0.020 ↑ 11.0 1 1

Hash Join (cost=21.70..22.84 rows=11 width=199) (actual time=0.019..0.020 rows=1 loops=1)

  • Hash Cond: (udt.user_id = u.user_id)
9. 0.007 0.007 ↑ 11.0 1 1

Seq Scan on users_device_tokens udt (cost=0.00..1.11 rows=11 width=183) (actual time=0.007..0.007 rows=1 loops=1)

10. 0.003 0.007 ↑ 520.0 1 1

Hash (cost=15.20..15.20 rows=520 width=48) (actual time=0.006..0.007 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
11. 0.004 0.004 ↑ 520.0 1 1

Seq Scan on users u (cost=0.00..15.20 rows=520 width=48) (actual time=0.003..0.004 rows=1 loops=1)

12. 0.017 0.017 ↓ 0.0 0 1

Index Scan using subscriptions__phone__idx on subscriptions s (cost=0.28..0.74 rows=1 width=19) (actual time=0.017..0.017 rows=0 loops=1)

  • Index Cond: (phone = u.phone)
  • Filter: ((deleted_at = '1970-01-01 05:30:00+05:30'::timestamp with time zone) AND (expiry >= CURRENT_TIMESTAMP) AND (expiry <= (date_trunc('day'::text, CURRENT_TIMESTAMP) + '7 days'::interval)))
  • Rows Removed by Filter: 6
Planning time : 0.325 ms
Execution time : 0.093 ms