explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JTVI

Settings
# exclusive inclusive rows x rows loops node
1. 2.039 1,141.309 ↑ 1.0 50 1

Limit (cost=1,135,206.65..1,135,206.78 rows=50 width=2,565) (actual time=1,139.268..1,141.309 rows=50 loops=1)

2. 238.747 1,139.270 ↑ 7,454.9 50 1

Sort (cost=1,135,206.65..1,136,138.52 rows=372,747 width=2,565) (actual time=1,139.267..1,139.270 rows=50 loops=1)

  • Sort Key: books_book.activated_at DESC, books_book.id DESC
  • Sort Method: top-N heapsort Memory: 291kB
3. 70.250 900.523 ↑ 3.4 110,597 1

Gather (cost=102,835.77..1,122,824.27 rows=372,747 width=2,565) (actual time=338.972..900.523 rows=110,597 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 30.345 830.273 ↑ 4.2 36,866 3

Hash Left Join (cost=101,835.77..1,084,549.57 rows=155,311 width=2,565) (actual time=352.397..830.273 rows=36,866 loops=3)

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

Hash Left Join (cost=101,834.70..1,083,708.08 rows=155,311 width=2,539) (actual time=352.315..799.876 rows=36,866 loops=3)

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

Hash Left Join (cost=12,293.53..923,478.21 rows=155,311 width=1,408) (actual time=109.566..336.932 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: 21985
7. 212.563 261.182 ↑ 4.8 58,850 3

Parallel Bitmap Heap Scan on books_book (cost=5,779.77..916,228.28 rows=280,395 width=1,223) (actual time=85.228..261.182 rows=58,850 loops=3)

  • Recheck Cond: (active AND is_readable AND (file_count > 0))
  • Heap Blocks: exact=47933
8. 48.619 48.619 ↑ 2.0 334,558 1

Bitmap Index Scan on idx_books_book_active_readable_file_count (cost=0.00..5,611.53 rows=672,949 width=0) (actual time=48.619..48.619 rows=334,558 loops=1)

9. 8.466 23.959 ↑ 1.7 19,557 3

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

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

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

11. 124.279 242.305 ↓ 1.0 114,880 3

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

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

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

13. 0.007 0.052 ↑ 1.0 3 3

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

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

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