explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5a5Q

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

Limit (cost=220,136.19..440,272.11 rows=10 width=1,652) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.28..26,592,418.72 rows=1,208 width=1,652) (actual rows= loops=)

  • Join Filter: (p.author = users.id)
3. 0.000 0.000 ↓ 0.0

Index Scan using posts_pkey on posts p (cost=0.28..660.40 rows=1,208 width=1,584) (actual rows= loops=)

  • Filter: (published = 'published'::published)
4. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..19.57 rows=263 width=36) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Seq Scan on users (cost=0.00..18.26 rows=263 width=36) (actual rows= loops=)

6.          

SubPlan (forNested Loop Left Join)

7. 0.000 0.000 ↓ 0.0

Aggregate (cost=21,848.30..21,848.31 rows=1 width=32) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Subquery Scan on t (cost=21,846.23..21,847.71 rows=118 width=1,067) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Sort (cost=21,846.23..21,846.53 rows=118 width=1,091) (actual rows= loops=)

  • Sort Key: c."createdAt
10. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=21.55..21,842.17 rows=118 width=1,091) (actual rows= loops=)

  • Hash Cond: (c.author = users_1.id)
11. 0.000 0.000 ↓ 0.0

Seq Scan on comments c (cost=0.00..1,146.71 rows=118 width=1,047) (actual rows= loops=)

  • Filter: (post = p.id)
12. 0.000 0.000 ↓ 0.0

Hash (cost=18.26..18.26 rows=263 width=36) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Seq Scan on users users_1 (cost=0.00..18.26 rows=263 width=36) (actual rows= loops=)

14.          

SubPlan (forHash Left Join)

15. 0.000 0.000 ↓ 0.0

Aggregate (cost=87.59..87.60 rows=1 width=8) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Seq Scan on comments_votes (cost=0.00..87.53 rows=23 width=4) (actual rows= loops=)

  • Filter: ((vote > 0) AND (comment = c.id))
17. 0.000 0.000 ↓ 0.0

Aggregate (cost=87.59..87.60 rows=1 width=8) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Seq Scan on comments_votes comments_votes_1 (cost=0.00..87.53 rows=23 width=4) (actual rows= loops=)

  • Filter: ((vote < 0) AND (comment = c.id))
19. 0.000 0.000 ↓ 0.0

Aggregate (cost=80.38..80.39 rows=1 width=4) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Seq Scan on posts_votes (cost=0.00..80.32 rows=24 width=4) (actual rows= loops=)

  • Filter: ((vote > 0) AND (post = p.id))
21. 0.000 0.000 ↓ 0.0

Aggregate (cost=80.38..80.39 rows=1 width=4) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Seq Scan on posts_votes posts_votes_1 (cost=0.00..80.32 rows=24 width=4) (actual rows= loops=)

  • Filter: ((vote < 0) AND (post = p.id))