explain.depesz.com

PostgreSQL's explain analyze made readable

Result: pjHO

Settings
# exclusive inclusive rows x rows loops node
1. 0.205 1,890.628 ↑ 1.0 10 1

Limit (cost=543,246.56..547,542.72 rows=10 width=405) (actual time=1,570.456..1,890.628 rows=10 loops=1)

2. 24.596 1,890.423 ↑ 22.5 10 1

Nested Loop Left Join (cost=543,246.56..639,910.17 rows=225 width=405) (actual time=1,570.454..1,890.423 rows=10 loops=1)

  • Join Filter: (rows_remaining.document_id = document.document_id)
  • Rows Removed by Join Filter: 62749
3. 160.368 1,308.607 ↑ 22.5 10 1

Nested Loop Left Join (cost=271,119.24..330,699.94 rows=225 width=603) (actual time=1,031.047..1,308.607 rows=10 loops=1)

  • Join Filter: (rows_total.document_id = document.document_id)
  • Rows Removed by Join Filter: 433885
4. 0.549 0.549 ↑ 22.5 10 1

Index Scan Backward using document_pkey on document (cost=0.29..22,502.57 rows=225 width=595) (actual time=0.207..0.549 rows=10 loops=1)

  • Filter: (COALESCE((metadata -> 'is_permanently_archived'::text), 'false'::jsonb) = 'false'::jsonb)
5. 171.374 1,147.690 ↓ 4.3 43,389 10

Materialize (cost=271,118.95..273,851.82 rows=10,184 width=12) (actual time=80.768..114.769 rows=43,389 loops=10)

6. 33.499 976.316 ↓ 4.3 43,393 1

Subquery Scan on rows_total (cost=271,118.95..273,800.90 rows=10,184 width=12) (actual time=807.670..976.316 rows=43,393 loops=1)

7. 61.828 942.817 ↓ 4.3 43,393 1

Finalize GroupAggregate (cost=271,118.95..273,699.06 rows=10,184 width=12) (actual time=807.668..942.817 rows=43,393 loops=1)

  • Group Key: rowdata.document_id
8. 0.000 880.989 ↓ 4.4 90,560 1

Gather Merge (cost=271,118.95..273,495.38 rows=20,368 width=12) (actual time=807.656..880.989 rows=90,560 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
9. 120.864 2,449.275 ↓ 3.0 30,187 3

Sort (cost=270,118.93..270,144.39 rows=10,184 width=12) (actual time=800.168..816.425 rows=30,187 loops=3)

  • Sort Key: rowdata.document_id
  • Sort Method: quicksort Memory: 2179kB
  • Worker 0: Sort Method: quicksort Memory: 2203kB
  • Worker 1: Sort Method: quicksort Memory: 2169kB
10. 784.368 2,328.411 ↓ 3.0 30,187 3

Partial HashAggregate (cost=269,339.14..269,440.98 rows=10,184 width=12) (actual time=755.570..776.137 rows=30,187 loops=3)

  • Group Key: rowdata.document_id
11. 1,544.043 1,544.043 ↑ 1.3 376,639 3

Parallel Seq Scan on rowdata (cost=0.00..266,968.76 rows=474,076 width=8) (actual time=0.044..514.681 rows=376,639 loops=3)

12. 25.170 557.220 ↑ 1.6 6,276 10

Materialize (cost=272,127.32..274,860.19 rows=10,184 width=12) (actual time=50.863..55.722 rows=6,276 loops=10)

13. 4.336 532.050 ↑ 1.6 6,277 1

Subquery Scan on rows_remaining (cost=272,127.32..274,809.27 rows=10,184 width=12) (actual time=508.627..532.050 rows=6,277 loops=1)

14. 8.605 527.714 ↑ 1.6 6,277 1

Finalize GroupAggregate (cost=272,127.32..274,707.43 rows=10,184 width=12) (actual time=508.625..527.714 rows=6,277 loops=1)

  • Group Key: rowdata_1.document_id
15. 0.000 519.109 ↑ 1.4 14,625 1

Gather Merge (cost=272,127.32..274,503.75 rows=20,368 width=12) (actual time=508.615..519.109 rows=14,625 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
16. 15.807 1,523.214 ↑ 2.1 4,875 3

Sort (cost=271,127.30..271,152.76 rows=10,184 width=12) (actual time=505.643..507.738 rows=4,875 loops=3)

  • Sort Key: rowdata_1.document_id
  • Sort Method: quicksort Memory: 423kB
  • Worker 0: Sort Method: quicksort Memory: 424kB
  • Worker 1: Sort Method: quicksort Memory: 416kB
17. 229.887 1,507.407 ↑ 2.1 4,875 3

Partial HashAggregate (cost=270,347.51..270,449.35 rows=10,184 width=12) (actual time=499.567..502.469 rows=4,875 loops=3)

  • Group Key: rowdata_1.document_id
18. 1,277.520 1,277.520 ↑ 1.6 129,363 3

Parallel Seq Scan on rowdata rowdata_1 (cost=0.00..269,339.14 rows=201,674 width=8) (actual time=0.040..425.840 rows=129,363 loops=3)

  • Filter: ((status <> 12) AND (status <> 2))
  • Rows Removed by Filter: 247276