explain.depesz.com

PostgreSQL's explain analyze made readable

Result: C7Td : Optimization for: Optimization for: Optimization for: evalution of vi_get_points; plan #K81I; plan #mNXs; plan #YA0f

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 243.585 306.300 ↓ 16.2 779 1

CTE Scan on filtered_points points (cost=11,712.27..12,189.72 rows=48 width=232) (actual time=60.701..306.300 rows=779 loops=1)

2.          

CTE selected_points

3. 5.361 53.583 ↓ 9.2 1,784 1

Gather (cost=1,000.00..11,643.25 rows=194 width=361) (actual time=1.936..53.583 rows=1,784 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 48.222 48.222 ↓ 7.3 595 3

Parallel Seq Scan on points points_1 (cost=0.00..10,623.85 rows=81 width=361) (actual time=0.434..48.222 rows=595 loops=3)

  • Filter: ('0103000000010000000500000048E17A14AEC72840068195438BAC494048E17A14AEC72840EC51B81E85AB4940C3F5285C8FC22840EC51B81E85AB4940C3F5285C8FC22840068195438BAC494048E17A14AEC72840068195438BAC4940'::geometry ~ offset_geom)
  • Rows Removed by Filter: 64228
5.          

CTE filtered_points

6. 56.630 56.630 ↓ 16.2 779 1

CTE Scan on selected_points points_2 (cost=0.00..3.88 rows=48 width=959) (actual time=1.947..56.630 rows=779 loops=1)

  • Filter: ((offset_geom IS NOT NULL) AND (is_duplicate IS FALSE) AND (is_latest IS TRUE))
  • Rows Removed by Filter: 1005
7.          

CTE points_with_objects

8. 0.003 58.039 ↓ 0.0 0 1

HashAggregate (cost=62.50..63.10 rows=48 width=548) (actual time=58.039..58.039 rows=0 loops=1)

  • Group Key: points_3.id
9. 0.037 58.036 ↓ 0.0 0 1

Hash Join (cost=3.12..61.97 rows=105 width=526) (actual time=58.036..58.036 rows=0 loops=1)

  • Hash Cond: (detected_objects.point_id = (points_3.id)::text)
10. 0.645 1.622 ↓ 0.0 0 1

Hash Semi Join (cost=1.56..59.97 rows=105 width=563) (actual time=1.621..1.622 rows=0 loops=1)

  • Hash Cond: (detected_objects.point_id = (filtered_points.id)::text)
11. 0.376 0.376 ↑ 1.0 2,316 1

Seq Scan on detected_objects (cost=0.00..51.16 rows=2,316 width=47) (actual time=0.016..0.376 rows=2,316 loops=1)

12. 0.315 0.601 ↓ 16.2 779 1

Hash (cost=0.96..0.96 rows=48 width=516) (actual time=0.601..0.601 rows=779 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 61kB
13. 0.286 0.286 ↓ 16.2 779 1

CTE Scan on filtered_points (cost=0.00..0.96 rows=48 width=516) (actual time=0.001..0.286 rows=779 loops=1)

14. 0.587 56.377 ↓ 16.2 779 1

Hash (cost=0.96..0.96 rows=48 width=516) (actual time=56.377..56.377 rows=779 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 61kB
15. 55.790 55.790 ↓ 16.2 779 1

CTE Scan on filtered_points points_3 (cost=0.00..0.96 rows=48 width=516) (actual time=0.001..55.790 rows=779 loops=1)

16.          

CTE detected_ids

17. 58.040 58.040 ↓ 0.0 0 1

CTE Scan on points_with_objects (cost=0.00..0.96 rows=48 width=516) (actual time=58.040..58.040 rows=0 loops=1)

18.          

SubPlan (forCTE Scan)

19. 0.779 4.674 ↑ 1.0 1 779

Limit (cost=0.29..6.30 rows=1 width=9) (actual time=0.006..0.006 rows=1 loops=779)

20. 3.895 3.895 ↑ 2.0 1 779

Index Scan using idx_segment_stats_segment_id on segment_stats (cost=0.29..12.31 rows=2 width=9) (actual time=0.005..0.005 rows=1 loops=779)

  • Index Cond: (points.segment_id = segment_id)
21. 58.041 58.041 ↓ 0.0 0 1

CTE Scan on detected_ids (cost=0.00..0.96 rows=48 width=516) (actual time=58.041..58.041 rows=0 loops=1)

22. 0.000 0.000 ↓ 0.0 0

CTE Scan on points_with_objects objects (cost=0.00..1.08 rows=1 width=32) (never executed)

  • Filter: ((points.id)::text = (point_id)::text)
Planning time : 3.846 ms
Execution time : 307.081 ms