explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1Gnv

Settings
# exclusive inclusive rows x rows loops node
1. 0.980 1,205.253 ↑ 1.0 50 1

Limit (cost=1,135,200.98..1,135,201.10 rows=50 width=2,565) (actual time=1,204.270..1,205.253 rows=50 loops=1)

2. 240.549 1,204.273 ↑ 7,454.9 50 1

Sort (cost=1,135,200.98..1,136,132.85 rows=372,747 width=2,565) (actual time=1,204.270..1,204.273 rows=50 loops=1)

  • Sort Key: books_book.activated_at DESC, books_book.id DESC
  • Sort Method: top-N heapsort Memory: 275kB
3. 99.526 963.724 ↑ 3.4 110,597 1

Gather (cost=102,830.10..1,122,818.59 rows=372,747 width=2,565) (actual time=369.324..963.724 rows=110,597 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 30.806 864.198 ↑ 4.2 36,866 3

Hash Left Join (cost=101,830.10..1,084,543.89 rows=155,311 width=2,565) (actual time=358.177..864.198 rows=36,866 loops=3)

  • Hash Cond: (books_book.subscription_id = payments_subscriptiontype.id)
5. 223.273 833.349 ↑ 4.2 36,866 3

Hash Left Join (cost=101,829.03..1,083,702.40 rows=155,311 width=2,539) (actual time=358.096..833.349 rows=36,866 loops=3)

  • Hash Cond: (books_book.main_author_id = authors_author.id)
6. 52.926 363.700 ↑ 4.2 36,866 3

Hash Left Join (cost=12,287.86..923,472.53 rows=155,311 width=1,408) (actual time=111.278..363.700 rows=36,866 loops=3)

  • Hash Cond: (books_book.rightholder_id = books_rightholder.id)
  • Filter: ((books_rightholder.litres_id <> ALL ('{9350031,9352293,9354901,9354639,9351777}'::text[])) OR (books_rightholder.litres_id IS NULL))
  • Rows Removed by Filter: 21983
7. 234.344 284.890 ↑ 4.8 58,849 3

Parallel Bitmap Heap Scan on books_book (cost=5,774.09..916,222.61 rows=280,395 width=1,223) (actual time=84.988..284.890 rows=58,849 loops=3)

  • Recheck Cond: (active AND is_readable AND (file_count > 0))
  • Heap Blocks: exact=38317
8. 50.546 50.546 ↑ 2.0 335,033 1

Bitmap Index Scan on idx_books_book_active_readable_file_count (cost=0.00..5,605.86 rows=672,949 width=0) (actual time=50.546..50.546 rows=335,033 loops=1)

9. 8.646 25.884 ↑ 1.7 19,557 3

Hash (cost=6,093.34..6,093.34 rows=33,634 width=185) (actual time=25.884..25.884 rows=19,557 loops=3)

  • Buckets: 65536 Batches: 1 Memory Usage: 3510kB
10. 17.238 17.238 ↑ 1.7 19,557 3

Seq Scan on books_rightholder (cost=0.00..6,093.34 rows=33,634 width=185) (actual time=0.036..17.238 rows=19,557 loops=3)

11. 127.174 246.376 ↓ 1.0 114,877 3

Hash (cost=72,149.52..72,149.52 rows=112,852 width=1,131) (actual time=246.376..246.376 rows=114,877 loops=3)

  • Buckets: 65536 Batches: 4 Memory Usage: 8683kB
12. 119.202 119.202 ↓ 1.0 114,877 3

Seq Scan on authors_author (cost=0.00..72,149.52 rows=112,852 width=1,131) (actual time=0.034..119.202 rows=114,877 loops=3)

13. 0.009 0.043 ↑ 1.0 3 3

Hash (cost=1.03..1.03 rows=3 width=26) (actual time=0.043..0.043 rows=3 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.034 0.034 ↑ 1.0 3 3

Seq Scan on payments_subscriptiontype (cost=0.00..1.03 rows=3 width=26) (actual time=0.034..0.034 rows=3 loops=3)