explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9HCl : update with index services (project_id, id) WHERE type = 'PrometheusService';

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 531.784 ↑ 1.0 1 1

Aggregate (cost=616.92..616.93 rows=1 width=8) (actual time=531.784..531.784 rows=1 loops=1)

  • Buffers: shared hit=11510 read=3989 dirtied=71
  • I/O Timings: read=494.755
2.          

CTE updated_records

3. 0.000 531.776 ↓ 0.0 0 1

ModifyTable on public.services (cost=593.61..616.77 rows=7 width=224) (actual time=531.775..531.776 rows=0 loops=1)

  • Buffers: shared hit=11510 read=3989 dirtied=71
  • I/O Timings: read=494.755
4.          

Initplan (for ModifyTable on public.services)

5. 0.002 531.748 ↓ 0.0 0 1

Nested Loop (cost=1.00..11,255.09 rows=19 width=0) (actual time=531.747..531.748 rows=0 loops=1)

  • Buffers: shared hit=11510 read=3989 dirtied=71
  • I/O Timings: read=494.755
6. 3.227 531.746 ↓ 0.0 0 1

Nested Loop (cost=0.72..11,244.45 rows=27 width=4) (actual time=531.746..531.746 rows=0 loops=1)

  • Buffers: shared hit=11510 read=3989 dirtied=71
  • I/O Timings: read=494.755
7. 512.145 512.145 ↓ 1.0 5,458 1

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

  • Index Cond: ((projects.id >= 1) AND (projects.id <= 10000))
  • Buffers: shared hit=600 read=3983 dirtied=71
  • I/O Timings: read=494.502
8. 16.374 16.374 ↓ 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.003..0.003 rows=0 loops=5,458)

  • Index Cond: (cluster_groups.group_id = projects.namespace_id)
  • Buffers: shared hit=10910 read=6
  • I/O Timings: read=0.253
9. 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
10. 531.772 531.772 ↓ 0.0 0 1

Result (cost=0.29..23.45 rows=7 width=224) (actual time=531.772..531.772 rows=0 loops=1)

  • Buffers: shared hit=11510 read=3989 dirtied=71
  • I/O Timings: read=494.755
11. 0.000 0.000 ↓ 0.0 0 0

Index Scan using temp_partial_indx_project_id_id on public.services (cost=0.29..23.45 rows=7 width=224) (actual time=0.000..0.000 rows=0 loops=0)

  • Index Cond: ((services.project_id >= 1) AND (services.project_id <= 10000))
  • Filter: ((NOT services.active) AND (services.properties = '{}'::text) AND ((services.type)::text = 'PrometheusService'::text))
  • Rows Removed by Filter: 0
12. 531.778 531.778 ↓ 0.0 0 1

CTE Scan on updated_records (cost=0.00..0.14 rows=7 width=0) (actual time=531.778..531.778 rows=0 loops=1)

  • Buffers: shared hit=11510 read=3989 dirtied=71
  • I/O Timings: read=494.755