explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gasu

Settings
# exclusive inclusive rows x rows loops node
1. 0.104 3,456.642 ↑ 1.0 10 1

Limit (cost=13,413.71..14,420.56 rows=10 width=78) (actual time=3,279.067..3,456.642 rows=10 loops=1)

2. 114.734 3,456.538 ↑ 17.5 10 1

Nested Loop Left Join (cost=13,413.71..31,033.69 rows=175 width=78) (actual time=3,279.065..3,456.538 rows=10 loops=1)

  • Join Filter: ((annotations_token.span && max_spans.max_span) AND (annotations_token.example_id = max_spans.example_id))
  • Rows Removed by Join Filter: 478298
3. 76.228 1,404.774 ↑ 17.5 10 1

Nested Loop (cost=10.37..17,177.76 rows=175 width=46) (actual time=1,404.429..1,404.774 rows=10 loops=1)

4. 69.574 875.372 ↓ 81.3 226,587 1

Nested Loop (cost=9.95..15,669.26 rows=2,788 width=46) (actual time=0.034..875.372 rows=226,587 loops=1)

5. 90.092 126.037 ↓ 81.3 226,587 1

Hash Join (cost=9.53..14,212.84 rows=2,788 width=32) (actual time=0.025..126.037 rows=226,587 loops=1)

  • Hash Cond: (annotations_taggedtoken.tag_id = t.id)
6. 35.931 35.931 ↑ 1.8 226,594 1

Seq Scan on annotations_taggedtoken (cost=0.00..13,090.02 rows=418,202 width=32) (actual time=0.004..35.931 rows=226,594 loops=1)

7. 0.004 0.014 ↓ 6.5 13 1

Hash (cost=9.50..9.50 rows=2 width=16) (actual time=0.013..0.014 rows=13 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
8. 0.006 0.010 ↓ 6.5 13 1

Bitmap Heap Scan on annotations_tag t (cost=4.16..9.50 rows=2 width=16) (actual time=0.008..0.010 rows=13 loops=1)

  • Recheck Cond: (schema_id = '021e5e8a-7fde-4626-a634-2b0e755f80e5'::uuid)
  • Heap Blocks: exact=1
9. 0.004 0.004 ↓ 6.5 13 1

Bitmap Index Scan on annotations_tag_schema_id_name_98abe476_uniq (cost=0.00..4.16 rows=2 width=0) (actual time=0.004..0.004 rows=13 loops=1)

  • Index Cond: (schema_id = '021e5e8a-7fde-4626-a634-2b0e755f80e5'::uuid)
10. 679.761 679.761 ↑ 1.0 1 226,587

Index Scan using annotations_token_pkey on annotations_token (cost=0.42..0.52 rows=1 width=46) (actual time=0.003..0.003 rows=1 loops=226,587)

  • Index Cond: (id = annotations_taggedtoken.token_id)
11. 453.174 453.174 ↓ 0.0 0 226,587

Index Scan using annotations_example_pkey on annotations_example ae (cost=0.42..0.54 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=226,587)

  • Index Cond: (id = annotations_token.example_id)
  • Filter: (dataset_id = 'fdd1926d-9081-4300-8b04-153dfcdb6f7b'::uuid)
  • Rows Removed by Filter: 1
12. 80.748 1,937.030 ↓ 327.6 47,831 10

Materialize (cost=13,403.33..13,409.17 rows=146 width=48) (actual time=176.987..193.703 rows=47,831 loops=10)

13. 7.944 1,856.282 ↓ 336.2 49,084 1

Subquery Scan on max_spans (cost=13,403.33..13,408.44 rows=146 width=48) (actual time=1,769.823..1,856.282 rows=49,084 loops=1)

14. 55.097 1,848.338 ↓ 336.2 49,084 1

GroupAggregate (cost=13,403.33..13,406.98 rows=146 width=52) (actual time=1,769.821..1,848.338 rows=49,084 loops=1)

  • Group Key: relevant_tokens_with_maximal_bounding_span.example_id, relevant_tokens_with_maximal_bounding_span.l
15. 67.623 1,793.241 ↓ 701.4 102,410 1

Sort (cost=13,403.33..13,403.70 rows=146 width=34) (actual time=1,769.805..1,793.241 rows=102,410 loops=1)

  • Sort Key: relevant_tokens_with_maximal_bounding_span.example_id, relevant_tokens_with_maximal_bounding_span.l
  • Sort Method: external merge Disk: 4424kB
16. 23.486 1,725.618 ↓ 701.4 102,410 1

Subquery Scan on relevant_tokens_with_maximal_bounding_span (cost=13,385.68..13,398.09 rows=146 width=34) (actual time=1,348.529..1,725.618 rows=102,410 loops=1)

17. 204.906 1,702.132 ↓ 701.4 102,410 1

WindowAgg (cost=13,385.68..13,396.63 rows=146 width=70) (actual time=1,348.527..1,702.132 rows=102,410 loops=1)

18. 109.909 1,497.226 ↓ 701.4 102,410 1

WindowAgg (cost=13,385.68..13,388.60 rows=146 width=62) (actual time=1,348.513..1,497.226 rows=102,410 loops=1)

19. 123.477 1,387.317 ↓ 701.4 102,410 1

Sort (cost=13,385.68..13,386.04 rows=146 width=30) (actual time=1,348.498..1,387.317 rows=102,410 loops=1)

  • Sort Key: annotations_token_1.example_id, annotations_token_1.span
  • Sort Method: external merge Disk: 4024kB
20. 0.000 1,263.840 ↓ 701.4 102,410 1

Gather Merge (cost=13,361.93..13,378.97 rows=146 width=30) (actual time=1,209.492..1,263.840 rows=102,410 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
21. 209.676 3,597.594 ↓ 467.6 34,137 3

Sort (cost=12,361.91..12,362.09 rows=73 width=30) (actual time=1,192.859..1,199.198 rows=34,137 loops=3)

  • Sort Key: annotations_token_1.span
  • Sort Method: quicksort Memory: 3107kB
  • Worker 0: Sort Method: quicksort Memory: 3899kB
  • Worker 1: Sort Method: quicksort Memory: 3655kB
22. 1,392.237 3,387.918 ↓ 467.6 34,137 3

Nested Loop (cost=10.37..12,359.65 rows=73 width=30) (actual time=617.142..1,129.306 rows=34,137 loops=3)

23. 1,749.330 1,995.681 ↓ 119.1 138,413 3

Nested Loop (cost=9.95..11,730.93 rows=1,162 width=30) (actual time=0.086..665.227 rows=138,413 loops=3)

24. 164.082 246.351 ↓ 119.1 138,413 3

Hash Join (cost=9.53..11,123.91 rows=1,162 width=16) (actual time=0.071..82.117 rows=138,413 loops=3)

  • Hash Cond: (annotations_taggedtoken_1.tag_id = a.id)
25. 82.269 82.269 ↑ 1.2 139,403 3

Parallel Seq Scan on annotations_taggedtoken annotations_taggedtoken_1 (cost=0.00..10,650.51 rows=174,251 width=32) (actual time=0.005..27.423 rows=139,403 loops=3)