explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FRDR

Settings
# exclusive inclusive rows x rows loops node
1. 7.995 57.406 ↑ 1.0 1,000 1

Limit (cost=296.02..591.16 rows=1,000 width=48) (actual time=43.613..57.406 rows=1,000 loops=1)

2.          

Initplan (for Limit)

3. 0.020 0.020 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=8) (actual time=0.010..0.020 rows=1 loops=1)

4. 17.161 49.391 ↑ 166.7 1,000 1

Index Scan using users_rand_id_index on users (cost=296.01..49,486.69 rows=166,667 width=48) (actual time=43.602..49.391 rows=1,000 loops=1)

  • Index Cond: (rand >= $0)
  • Filter: (NOT (hashed SubPlan 3))
5.          

SubPlan (for Index Scan)

6. 19.666 32.230 ↑ 1.0 2,000 1

Limit (cost=0.44..290.58 rows=2,000 width=16) (actual time=0.054..32.230 rows=2,000 loops=1)

7.          

Initplan (for Limit)

8. 0.021 0.021 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=8) (actual time=0.008..0.021 rows=1 loops=1)

9. 12.543 12.543 ↑ 166.7 2,000 1

Index Only Scan using users_rand_id_index on users users_1 (cost=0.42..48,357.77 rows=333,334 width=16) (actual time=0.042..12.543 rows=2,000 loops=1)

  • Index Cond: (rand >= $1)
  • Heap Fetches: 2000