explain.depesz.com

PostgreSQL's explain analyze made readable

Result: G8NL

Settings
# exclusive inclusive rows x rows loops node
1. 0.163 4,046.152 ↑ 1.0 50 1

Limit (cost=941,292.90..941,293.03 rows=50 width=4,140) (actual time=4,045.980..4,046.152 rows=50 loops=1)

2. 458.324 4,045.989 ↑ 2,032.6 50 1

Sort (cost=941,292.90..941,546.98 rows=101,630 width=4,140) (actual time=4,045.978..4,045.989 rows=50 loops=1)

  • Sort Key: books_book.is_readable_from DESC NULLS LAST, books_book.id DESC
  • Sort Method: top-N heapsort Memory: 322kB
3. 256.490 3,587.665 ↓ 1.4 142,406 1

Nested Loop Left Join (cost=129,267.91..937,916.83 rows=101,630 width=4,140) (actual time=1,073.087..3,587.665 rows=142,406 loops=1)

  • Join Filter: (books_book.subscription_id = payments_subscriptiontype.id)
  • Rows Removed by Join Filter: 314880
4. 414.540 3,331.175 ↓ 1.4 142,406 1

Gather (cost=129,267.91..932,548.13 rows=101,630 width=4,114) (actual time=1,073.051..3,331.175 rows=142,406 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
5. 68.449 2,916.635 ↓ 1.1 47,469 3 / 3

Hash Left Join (cost=128,267.91..921,385.13 rows=42,346 width=4,114) (actual time=1,105.267..2,916.635 rows=47,469 loops=3)

  • Hash Cond: (books_book.rightholder_id = books_rightholder.id)
6. 745.758 2,776.702 ↓ 1.1 47,469 3 / 3

Hash Left Join (cost=120,736.00..913,742.05 rows=42,346 width=3,884) (actual time=1,033.304..2,776.702 rows=47,469 loops=3)

  • Hash Cond: (books_book.main_author_id = authors_author.id)
7. 45.182 998.727 ↓ 1.1 47,469 3 / 3

Nested Loop (cost=0.42..725,019.32 rows=42,346 width=2,753) (actual time=0.362..998.727 rows=47,469 loops=3)

8. 268.426 268.426 ↑ 1.1 76,124 3 / 3

Parallel Seq Scan on regions_regionbook (cost=0.00..12,966.36 rows=85,151 width=4) (actual time=0.264..268.426 rows=76,124 loops=3)

  • Filter: (is_active AND is_readable AND (region_id = 1))
  • Rows Removed by Filter: 101482
9. 685.119 685.119 ↑ 1.0 1 228,373 / 3

Index Scan using idx_books_book_active_activated_at on books_book (cost=0.42..8.36 rows=1 width=2,753) (actual time=0.009..0.009 rows=1 loops=228,373)

  • Index Cond: (id = regions_regionbook.book_id)
  • Filter: (((NOT is_selfpub) OR (is_selfpub IS NULL)) AND (file_count > 0))
  • Rows Removed by Filter: 0
10. 531.027 1,032.217 ↑ 1.4 200,107 3 / 3

Hash (cost=78,192.70..78,192.70 rows=276,070 width=1,131) (actual time=1,032.216..1,032.217 rows=200,107 loops=3)

  • Buckets: 65536 Batches: 8 Memory Usage: 13559kB
11. 501.190 501.190 ↑ 1.4 200,107 3 / 3

Seq Scan on authors_author (cost=0.00..78,192.70 rows=276,070 width=1,131) (actual time=0.036..501.190 rows=200,107 loops=3)

12. 23.150 71.484 ↑ 1.8 27,430 3 / 3

Hash (cost=6,908.07..6,908.07 rows=49,907 width=230) (actual time=71.484..71.484 rows=27,430 loops=3)

  • Buckets: 65536 Batches: 1 Memory Usage: 7729kB
13. 48.334 48.334 ↑ 1.8 27,430 3 / 3

Seq Scan on books_rightholder (cost=0.00..6,908.07 rows=49,907 width=230) (actual time=0.041..48.334 rows=27,430 loops=3)

14. 0.000 0.000 ↑ 1.3 3 142,406

Materialize (cost=0.00..1.06 rows=4 width=26) (actual time=0.000..0.000 rows=3 loops=142,406)

15. 0.014 0.014 ↑ 1.0 4 1

Seq Scan on payments_subscriptiontype (cost=0.00..1.04 rows=4 width=26) (actual time=0.012..0.014 rows=4 loops=1)

Planning time : 12.983 ms
Execution time : 4,047.136 ms