explain.depesz.com

PostgreSQL's explain analyze made readable

Result: B5B3

Settings
# exclusive inclusive rows x rows loops node
1. 0.073 8.556 ↑ 1.0 20 1

Nested Loop (cost=2,943..4,195.99 rows=20 width=145) (actual time=5.156..8.556 rows=20 loops=1)

  • Buffers: shared hit=1347
2. 0.020 5.043 ↑ 1.0 20 1

Nested Loop (cost=2,942.71..3,125.04 rows=20 width=52) (actual time=4.936..5.043 rows=20 loops=1)

  • Buffers: shared hit=1031
3. 1.150 4.943 ↑ 1.0 20 1

Limit (cost=2,942.29..2,956.04 rows=20 width=4) (actual time=4.914..4.943 rows=20 loops=1)

  • Buffers: shared hit=951
4. 3.793 3.793 ↑ 3.6 4,300 1

Index Only Scan using id_genre_id_book_index on genres2books g2b2 (cost=0.42..10,788.41 rows=15,695 width=4) (actual time=0.021..3.793 rows=4,300 loops=1)

  • Index Cond: (g2b2.id_genre = 24)
  • Buffers: shared hit=951
5. 0.080 0.080 ↑ 1.0 1 20

Index Scan using books_pkey on books b (cost=0.42..8.44 rows=1 width=52) (actual time=0.004..0.004 rows=1 loops=20)

  • Index Cond: (b.id_book = g2b2.id_book)
  • Buffers: shared hit=80
6. 0.060 0.060 ↓ 0.0 0 20

Index Scan using series_pkey on series s (cost=0.29..0.31 rows=1 width=37) (actual time=0.003..0.003 rows=0 loops=20)

  • Index Cond: (b.series_id_series = s.id_series)
  • Buffers: shared hit=30
7.          

SubPlan (forNested Loop)

8. 0.040 0.260 ↑ 3.0 1 20

Aggregate (cost=0.72..36.98 rows=3 width=36) (actual time=0.013..0.013 rows=1 loops=20)

  • Buffers: shared hit=146
9. 0.030 0.220 ↑ 3.0 1 20

Nested Loop (cost=0.72..36.91 rows=3 width=29) (actual time=0.009..0.011 rows=1 loops=20)

  • Buffers: shared hit=146
10. 0.080 0.080 ↑ 3.0 1 20

Index Only Scan using books2authors_pkey on books2authors b2a (cost=0.42..11.98 rows=3 width=8) (actual time=0.003..0.004 rows=1 loops=20)

  • Index Cond: (b2a.id_book = b.id_book)
  • Buffers: shared hit=80
11. 0.110 0.110 ↑ 1.0 1 22

Index Scan using authors_pkey on authors a (cost=0.29..8.31 rows=1 width=29) (actual time=0.005..0.005 rows=1 loops=22)

  • Index Cond: (a.id_author = b2a.id_author)
  • Buffers: shared hit=66
12. 0.120 3.120 ↑ 1.0 1 20

Aggregate (cost=10.24..16.26 rows=1 width=36) (actual time=0.156..0.156 rows=1 loops=20)

  • Buffers: shared hit=140
13. 1.500 3.000 ↑ 1.0 2 20

Hash Join (cost=10.24..16.24 rows=2 width=42) (actual time=0.023..0.15 rows=2 loops=20)

  • Buffers: shared hit=140
14. 1.380 1.380 ↑ 1.0 237 20

Seq Scan on genres g (cost=0..5.37 rows=237 width=42) (actual time=0.002..0.069 rows=237 loops=20)

  • Buffers: shared hit=60
15. 0.060 0.120 ↑ 1.0 2 20

Hash (cost=10.21..10.21 rows=2 width=4) (actual time=0.006..0.006 rows=2 loops=20)

  • Buffers: shared hit=80
16. 0.060 0.060 ↑ 1.0 2 20

Index Only Scan using genres2books_pkey on genres2books g2b (cost=0.42..10.21 rows=2 width=4) (actual time=0.003..0.003 rows=2 loops=20)

  • Index Cond: (g2b.id_book = b.id_book)
  • Buffers: shared hit=80