explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DRGK

Settings
# exclusive inclusive rows x rows loops node
1. 0.101 578,587.903 ↑ 1.0 1 1

Aggregate (cost=11,650.82..11,650.83 rows=1 width=32) (actual time=578,587.903..578,587.903 rows=1 loops=1)

2.          

CTE relevant_tokens

3. 74.233 253.963 ↓ 64.1 85,472 1

Gather (cost=2,626.90..9,838.30 rows=1,333 width=144) (actual time=142.699..253.963 rows=85,472 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 98.930 179.730 ↓ 51.3 28,491 3

Hash Join (cost=1,626.90..8,705.00 rows=555 width=144) (actual time=137.111..179.730 rows=28,491 loops=3)

  • Hash Cond: (annotations_token.example_id = ae.id)
5. 56.023 56.023 ↑ 1.1 104,429 3

Parallel Seq Scan on annotations_token (cost=0.00..6,786.35 rows=111,135 width=144) (actual time=0.004..56.023 rows=104,429 loops=3)

6. 14.446 24.777 ↓ 20.7 11,845 3

Hash (cost=1,619.75..1,619.75 rows=572 width=16) (actual time=24.777..24.777 rows=11,845 loops=3)

  • Buckets: 16384 (originally 1024) Batches: 1 (originally 1) Memory Usage: 684kB
7. 9.825 10.331 ↓ 20.7 11,845 3

Bitmap Heap Scan on annotations_example ae (cost=24.85..1,619.75 rows=572 width=16) (actual time=0.547..10.331 rows=11,845 loops=3)

  • Recheck Cond: (dataset_id = 'fdd1926d-9081-4300-8b04-153dfcdb6f7b'::uuid)
  • Heap Blocks: exact=412
8. 0.506 0.506 ↓ 20.7 11,845 3

Bitmap Index Scan on annotations_example_dataset_id_73670ea1 (cost=0.00..24.71 rows=572 width=0) (actual time=0.506..0.506 rows=11,845 loops=3)

  • Index Cond: (dataset_id = 'fdd1926d-9081-4300-8b04-153dfcdb6f7b'::uuid)
9.          

CTE relevant_tagged_tokens

10. 0.031 578,587.292 ↑ 1.0 20 1

Limit (cost=89.51..1,642.52 rows=20 width=88) (actual time=577,737.156..578,587.292 rows=20 loops=1)

11. 253,522.202 578,587.261 ↑ 3.8 20 1

Nested Loop (cost=89.51..5,913.32 rows=75 width=88) (actual time=577,737.154..578,587.261 rows=20 loops=1)

  • Join Filter: (annotations_taggedtoken.token_id = relevant_tokens.id)
  • Rows Removed by Join Filter: 1126264696
12. 37.914 108.757 ↓ 1,198.0 13,178 1

Hash Left Join (cost=89.51..5,569.70 rows=11 width=48) (actual time=2.540..108.757 rows=13,178 loops=1)

  • Hash Cond: (annotations_taggedtoken.id = annotations_taggedtokenreview.tagged_token_id)
  • Filter: (annotations_taggedtokenreview.correct IS NULL)
  • Rows Removed by Filter: 40
13. 17.206 70.811 ↓ 5.9 13,218 1

Nested Loop (cost=55.66..5,233.53 rows=2,239 width=48) (actual time=2.502..70.811 rows=13,218 loops=1)

14. 0.017 0.017 ↑ 1.0 1 1

Index Scan using annotations_tag_schema_id_3a781200 on annotations_tag a (cost=0.14..8.16 rows=1 width=16) (actual time=0.016..0.017 rows=1 loops=1)

  • Index Cond: (schema_id = '021e5e8a-7fde-4626-a634-2b0e755f80e5'::uuid)
15. 51.914 53.588 ↓ 5.4 13,218 1

Bitmap Heap Scan on annotations_taggedtoken (cost=55.51..5,200.74 rows=2,463 width=48) (actual time=2.481..53.588 rows=13,218 loops=1)

  • Recheck Cond: (tag_id = a.id)
  • Heap Blocks: exact=3937
16. 1.674 1.674 ↓ 10.3 25,479 1

Bitmap Index Scan on annotations_taggedtoken_tag_id_433afbe9 (cost=0.00..54.89 rows=2,463 width=0) (actual time=1.673..1.674 rows=25,479 loops=1)

  • Index Cond: (tag_id = a.id)
17. 0.015 0.032 ↑ 26.5 40 1

Hash (cost=20.60..20.60 rows=1,060 width=17) (actual time=0.031..0.032 rows=40 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 18kB
18. 0.017 0.017 ↑ 26.5 40 1

Seq Scan on annotations_taggedtokenreview (cost=0.00..20.60 rows=1,060 width=17) (actual time=0.005..0.017 rows=40 loops=1)

19. 324,956.302 324,956.302 ↓ 64.1 85,466 13,178

CTE Scan on relevant_tokens (cost=0.00..26.66 rows=1,333 width=96) (actual time=0.014..24.659 rows=85,466 loops=13,178)

20.          

CTE tagged_token_group

21. 0.281 578,587.679 ↑ 2.5 8 1

HashAggregate (cost=0.55..0.80 rows=20 width=48) (actual time=578,587.672..578,587.679 rows=8 loops=1)

  • Group Key: relevant_tagged_tokens.example_id
22. 578,587.398 578,587.398 ↑ 1.0 20 1

CTE Scan on relevant_tagged_tokens (cost=0.00..0.40 rows=20 width=56) (actual time=577,737.168..578,587.398 rows=20 loops=1)

23.          

CTE examples

24. 0.016 578,587.771 ↓ 8.0 8 1

Nested Loop (cost=0.42..169.18 rows=1 width=310) (actual time=578,587.716..578,587.771 rows=8 loops=1)

25. 578,587.707 578,587.707 ↑ 2.5 8 1

CTE Scan on tagged_token_group (cost=0.00..0.40 rows=20 width=48) (actual time=578,587.691..578,587.707 rows=8 loops=1)

26. 0.048 0.048 ↑ 1.0 1 8

Index Scan using annotations_example_pkey on annotations_example a_1 (cost=0.42..8.44 rows=1 width=278) (actual time=0.006..0.006 rows=1 loops=8)

  • Index Cond: (id = tagged_token_group.example_id)
  • Filter: (dataset_id = 'fdd1926d-9081-4300-8b04-153dfcdb6f7b'::uuid)
27. 578,587.802 578,587.802 ↓ 8.0 8 1

CTE Scan on examples (cost=0.00..0.02 rows=1 width=24) (actual time=578,587.728..578,587.802 rows=8 loops=1)