explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BdSw : create with index services (project_id, id) WHERE type = 'PrometheusService' and COALESCE(active, false) = false;

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

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

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

CTE created_records

3. 0.004 20.676 ↓ 0.0 0 1

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

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

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

  • Buffers: shared hit=15501 read=8
  • I/O Timings: read=4.063
5. 2.718 20.671 ↓ 0.0 0 1

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

  • Buffers: shared hit=15501 read=8
  • I/O Timings: read=4.063
6. 1.205 12.495 ↓ 5,458.0 5,458 1

Merge Left Join (cost=0.99..9,627.34 rows=1 width=8) (actual time=4.294..12.495 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=4.063
7. 7.039 7.039 ↓ 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.039..7.039 rows=5,458 loops=1)

  • Index Cond: ((projects.id >= 1) AND (projects.id <= 10000))
  • Buffers: shared hit=4581
8. 4.251 4.251 ↓ 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=4.251..4.251 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=4.063
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. 20.678 20.678 ↓ 0.0 0 1

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

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