explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TZmV : create with exec index services (project_id, id) WHERE type = 'PrometheusService' and active = false OR active IS NULL;

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 14.487 ↑ 1.0 1 1

Aggregate (cost=9,628.10..9,628.11 rows=1 width=8) (actual time=14.487..14.487 rows=1 loops=1)

  • Buffers: shared hit=15501 read=8
  • I/O Timings: read=0.395
2.          

CTE created_records

3. 0.002 14.482 ↓ 0.0 0 1

ModifyTable on public.services (cost=1.56..9,628.08 rows=1 width=1,181) (actual time=14.482..14.482 rows=0 loops=1)

  • Buffers: shared hit=15501 read=8
  • I/O Timings: read=0.395
4. 0.001 14.480 ↓ 0.0 0 1

Nested Loop (cost=1.56..9,628.08 rows=1 width=1,181) (actual time=14.480..14.480 rows=0 loops=1)

  • Buffers: shared hit=15501 read=8
  • I/O Timings: read=0.395
5. 1.289 14.479 ↓ 0.0 0 1

Nested Loop (cost=1.27..9,627.66 rows=1 width=8) (actual time=14.479..14.479 rows=0 loops=1)

  • Buffers: shared hit=15501 read=8
  • I/O Timings: read=0.395
6. 1.002 7.732 ↓ 5,458.0 5,458 1

Merge Left Join (cost=0.99..9,627.34 rows=1 width=8) (actual time=0.580..7.732 rows=5,458 loops=1)

  • Merge Cond: (projects.id = services_1.project_id)
  • Filter: (services_1.id IS NULL)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=4585 read=8
  • I/O Timings: read=0.395
7. 6.180 6.180 ↓ 1.0 5,458 1

Index Scan using projects_pkey on public.projects (cost=0.43..9,535.31 rows=5,311 width=8) (actual time=0.028..6.180 rows=5,458 loops=1)

  • Index Cond: ((projects.id >= 1) AND (projects.id <= 10000))
  • Buffers: shared hit=4581
8. 0.550 0.550 ↓ 0.0 0 1

Index Scan using index_services_on_project_id_and_type on public.services services_1 (cost=0.56..78.71 rows=12 width=8) (actual time=0.550..0.550 rows=0 loops=1)

  • Index Cond: ((services_1.project_id >= 1) AND (services_1.project_id <= 10000) AND ((services_1.type)::text = 'PrometheusService'::text))
  • Buffers: shared hit=4 read=8
  • I/O Timings: read=0.395
9. 5.458 5.458 ↓ 0.0 0 5,458

Index Scan using index_cluster_groups_on_group_id on public.cluster_groups (cost=0.28..0.31 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=5,458)

  • Index Cond: (cluster_groups.group_id = projects.namespace_id)
  • Buffers: shared hit=10916
10. 0.000 0.000 ↓ 0.0 0 0

Index Scan using index_clusters_applications_prometheus_on_cluster_id on public.clusters_applications_prometheus (cost=0.29..0.38 rows=1 width=4) (actual time=0.000..0.000 rows=0 loops=0)

  • Index Cond: (clusters_applications_prometheus.cluster_id = cluster_groups.cluster_id)
  • Filter: (clusters_applications_prometheus.status = ANY ('{3,5}'::integer[]))
  • Rows Removed by Filter: 0
11. 14.484 14.484 ↓ 0.0 0 1

CTE Scan on created_records (cost=0.00..0.02 rows=1 width=0) (actual time=14.484..14.484 rows=0 loops=1)

  • Buffers: shared hit=15501 read=8
  • I/O Timings: read=0.395