explain.depesz.com

PostgreSQL's explain analyze made readable

Result: pq79

Settings
# exclusive inclusive rows x rows loops node
1. 0.024 0.287 ↑ 128,699.0 8 1

Nested Loop Left Join (cost=514.37..18,613,546.07 rows=1,029,592 width=1,430) (actual time=0.095..0.287 rows=8 loops=1)

2. 0.002 0.247 ↑ 128,699.0 8 1

Nested Loop Left Join (cost=514.09..9,921,215.61 rows=1,029,592 width=1,780) (actual time=0.086..0.247 rows=8 loops=1)

3. 0.006 0.229 ↑ 128,699.0 8 1

Nested Loop Left Join (cost=513.80..1,352,436.19 rows=1,029,592 width=1,696) (actual time=0.081..0.229 rows=8 loops=1)

4. 0.005 0.111 ↑ 8.4 8 1

Nested Loop Left Join (cost=10.29..925.20 rows=67 width=1,694) (actual time=0.038..0.111 rows=8 loops=1)

5. 0.001 0.090 ↑ 8.4 8 1

Nested Loop Left Join (cost=10.01..476.76 rows=67 width=1,679) (actual time=0.035..0.090 rows=8 loops=1)

6. 0.003 0.081 ↑ 8.4 8 1

Nested Loop Left Join (cost=9.72..467.62 rows=67 width=1,664) (actual time=0.030..0.081 rows=8 loops=1)

7. 0.024 0.038 ↑ 8.4 8 1

Bitmap Heap Scan on words_games g (cost=9.29..263.40 rows=67 width=1,456) (actual time=0.020..0.038 rows=8 loops=1)

  • Recheck Cond: (((5 = player1) AND (COALESCE(finished, 'infinity'::timestamp with time zone) > (CURRENT_TIMESTAMP - '1 day'::interval))) OR ((5 = player2) AND (COALESCE(finished, 'infinity'::timestamp with time zone) > (CURRENT_TIMESTAMP - '1 day'::interval))))
  • Filter: (COALESCE(finished, 'infinity'::timestamp with time zone) > (CURRENT_TIMESTAMP - '1 day'::interval))
  • Heap Blocks: exact=8
8. 0.000 0.014 ↓ 0.0 0 1

BitmapOr (cost=9.29..9.29 rows=67 width=0) (actual time=0.014..0.014 rows=0 loops=1)

9. 0.008 0.008 ↑ 4.0 1 1

Bitmap Index Scan on words_games_player1_coalesce_idx (cost=0.00..4.33 rows=4 width=0) (actual time=0.008..0.008 rows=1 loops=1)

  • Index Cond: ((5 = player1) AND (COALESCE(finished, 'infinity'::timestamp with time zone) > (CURRENT_TIMESTAMP - '1 day'::interval)))
10. 0.006 0.006 ↑ 9.0 7 1

Bitmap Index Scan on words_games_player2_coalesce_idx (cost=0.00..4.92 rows=63 width=0) (actual time=0.006..0.006 rows=7 loops=1)

  • Index Cond: ((5 = player2) AND (COALESCE(finished, 'infinity'::timestamp with time zone) > (CURRENT_TIMESTAMP - '1 day'::interval)))
11. 0.008 0.040 ↑ 1.0 1 8

Limit (cost=0.43..3.03 rows=1 width=216) (actual time=0.004..0.005 rows=1 loops=8)

12. 0.032 0.032 ↑ 41.0 1 8

Index Scan using words_moves_gid_played_idx on words_moves m (cost=0.43..107.05 rows=41 width=216) (actual time=0.004..0.004 rows=1 loops=8)

  • Index Cond: (gid = g.gid)
13. 0.004 0.008 ↑ 1.0 1 8

Materialize (cost=0.29..8.31 rows=1 width=15) (actual time=0.001..0.001 rows=1 loops=8)

14. 0.004 0.004 ↑ 1.0 1 1

Index Scan using words_users_pkey on words_users u1 (cost=0.29..8.30 rows=1 width=15) (actual time=0.004..0.004 rows=1 loops=1)

  • Index Cond: (uid = 5)
15. 0.016 0.016 ↑ 1.0 1 8

Index Scan using words_users_pkey on words_users u2 (cost=0.29..6.69 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=8)

  • Index Cond: (uid = CASE WHEN (g.player1 = 5) THEN g.player2 ELSE g.player1 END)
16. 0.008 0.112 ↑ 15,367.0 1 8

Bitmap Heap Scan on words_geoip i2 (cost=503.51..20,018.14 rows=15,367 width=23) (actual time=0.014..0.014 rows=1 loops=8)

  • Recheck Cond: (CASE WHEN (g.player1 = 5) THEN u2.ip ELSE u1.ip END <<= block)
  • Heap Blocks: exact=7
17. 0.104 0.104 ↑ 15,367.0 1 8

Bitmap Index Scan on words_geoip_block_idx (cost=0.00..499.67 rows=15,367 width=0) (actual time=0.013..0.013 rows=1 loops=8)

  • Index Cond: (CASE WHEN (g.player1 = 5) THEN u2.ip ELSE u1.ip END <<= block)
18. 0.000 0.016 ↑ 1.0 1 8

Limit (cost=0.29..8.30 rows=1 width=180) (actual time=0.002..0.002 rows=1 loops=8)

19. 0.016 0.016 ↑ 1.0 1 8

Index Scan using words_social_uid_stamp_idx on words_social s1 (cost=0.29..8.30 rows=1 width=180) (actual time=0.002..0.002 rows=1 loops=8)

  • Index Cond: (uid = u1.uid)
20. 0.000 0.016 ↑ 1.0 1 8

Limit (cost=0.29..8.30 rows=1 width=180) (actual time=0.002..0.002 rows=1 loops=8)

21. 0.016 0.016 ↑ 1.0 1 8

Index Scan using words_social_uid_stamp_idx on words_social s2 (cost=0.29..8.30 rows=1 width=180) (actual time=0.002..0.002 rows=1 loops=8)

  • Index Cond: (uid = u2.uid)