PgHero
No long running queries
Connections healthy 7
Vacuuming healthy
No columns near integer overflow
No invalid indexes or constraints
43 duplicate indexes
No suggested indexes
1 slow query

Duplicate Indexes

These indexes exist, but aren’t needed. Remove them for faster writes.

rails generate migration remove_unneeded_indexes

And paste

remove_index :categories, name: "idx_categories_parent_id", column: :parent_id
remove_index :categories, name: "idx_categories_slug", column: :slug
remove_index :nc_api_token_scopes, name: "idx_api_token_scopes_token", column: :fk_api_token_id
remove_index :nc_bases_v2, name: "nc_bases_managed_app_id_idx", column: :managed_app_id
remove_index :nc_bookmarks, name: "nc_bookmarks_fk_user_id_index", column: :fk_user_id
remove_index :nc_date_dependency_v2, name: "nc_date_dep_model_idx", column: :fk_model_id
remove_index :nc_follower, name: "nc_follower_fk_user_id_index", column: :fk_user_id
remove_index :nc_form_view_columns_v2, name: "nc_form_view_columns_v2_fk_view_id_index", column: :fk_view_id
remove_index :nc_form_view_v2, name: "nc_form_view_v2_oldpk_idx", column: :fk_view_id
remove_index :nc_gallery_view_columns_v2, name: "nc_gallery_view_columns_v2_fk_view_id_index", column: :fk_view_id
remove_index :nc_gallery_view_v2, name: "nc_gallery_view_v2_oldpk_idx", column: :fk_view_id
remove_index :nc_grid_view_columns_v2, name: "nc_grid_view_columns_v2_fk_view_id_index", column: :fk_view_id
remove_index :nc_grid_view_v2, name: "nc_grid_view_v2_oldpk_idx", column: :fk_view_id
remove_index :nc_integration_links_v2, name: "nc_il_integration_idx", column: :fk_integration_id
remove_index :nc_kanban_view_columns_v2, name: "nc_kanban_view_columns_v2_fk_view_id_index", column: :fk_view_id
remove_index :nc_kanban_view_v2, name: "nc_kanban_view_v2_oldpk_idx", column: :fk_view_id
remove_index :nc_list_view_columns_v2, name: "nc_outline_view_columns_v2_fk_view_id_index", column: :fk_view_id
remove_index :nc_managed_app_deployment_logs, name: "nc_sandbox_deployment_logs_base_id_idx", column: :base_id
remove_index :nc_managed_app_versions, name: "nc_managed_app_versions_managed_app_id_idx", column: :fk_managed_app_id
remove_index :nc_managed_app_versions, name: "nc_managed_app_versions_ordering_idx", column: [:fk_managed_app_id, :version_number]
remove_index :nc_managed_apps, name: "nc_sandboxes_base_id_idx", column: :base_id
remove_index :nc_map_view_columns_v2, name: "nc_map_view_columns_v2_fk_view_id_index", column: :fk_view_id
remove_index :nc_map_view_v2, name: "nc_map_view_v2_oldpk_idx", column: :fk_view_id
remove_index :nc_model_stats_v2, name: "nc_model_stats_v2_fk_workspace_id_index", column: :fk_workspace_id
remove_index :nc_oauth_authorization_codes, name: "nc_oauth_authorization_codes_code_index", column: :code
remove_index :nc_oauth_authorization_codes, name: "nc_oauth_authorization_codes_fk_client_id_index", column: :fk_client_id
remove_index :nc_oauth_tokens, name: "nc_oauth_tokens_fk_client_id_index", column: :fk_client_id
remove_index :nc_oauth_tokens, name: "nc_oauth_tokens_is_revoked_index", column: :is_revoked
remove_index :nc_principal_assignments, name: "nc_principal_assignments_principal_idx", column: [:principal_type, :principal_ref_id]
remove_index :nc_principal_assignments, name: "nc_principal_assignments_resource_idx", column: [:resource_type, :resource_id]
remove_index :nc_principal_assignments, name: "nc_principal_assignments_resource_principal_type_idx", column: [:resource_type, :resource_id, :principal_type]
remove_index :nc_record_templates, name: "nc_record_templates_base_id_index", column: :base_id
remove_index :nc_teams, name: "nc_teams_scim_external_id_idx", column: :scim_external_id
remove_index :product_images, name: "idx_product_images_product_id", column: :product_id
remove_index :product_images, name: "idx_product_images_product", column: :product_id
remove_index :product_images, name: "idx_product_images_primary", column: [:product_id, :is_primary]
remove_index :product_images, name: "idx_product_images_variant", column: :variant_id
remove_index :products, name: "idx_products_brand_id", column: :brand_id
remove_index :products, name: "idx_products_category_id", column: :category_id
remove_index :products, name: "idx_products_category", column: :category_id
remove_index :products, name: "idx_products_cat_price_compound", column: [:category_id, :base_price]
remove_index :products, name: "idx_products_id", column: :id
remove_index :products, name: "idx_products_title_search", column: :"title gin_trgm_ops"
Details
On categories
idx_categories_parent_id (parent_id)
is covered by
idx_categories_parent (parent_id)
On categories
idx_categories_slug (slug)
is covered by
categories_slug_key (slug)
On nc_api_token_scopes
idx_api_token_scopes_token (fk_api_token_id)
is covered by
idx_api_token_scopes_unique (fk_api_token_id, resource_type, resource_id)
On nc_bases_v2
nc_bases_managed_app_id_idx (managed_app_id)
is covered by
nc_bases_managed_app_auto_update_idx (managed_app_id, auto_update)
On nc_bookmarks
nc_bookmarks_fk_user_id_index (fk_user_id)
is covered by
nc_bookmarks_fk_user_id_target_type_target_id_unique (fk_user_id, target_type, target_id)
On nc_date_dependency_v2
nc_date_dep_model_idx (fk_model_id)
is covered by
nc_date_dep_model_view_idx (fk_model_id, fk_gantt_view_id)
On nc_follower
nc_follower_fk_user_id_index (fk_user_id)
is covered by
nc_follower_pkey (fk_user_id, fk_follower_id)
On nc_form_view_columns_v2
nc_form_view_columns_v2_fk_view_id_index (fk_view_id)
is covered by
nc_form_view_columns_v2_fk_view_id_fk_column_id_index (fk_view_id, fk_column_id)
On nc_form_view_v2
nc_form_view_v2_oldpk_idx (fk_view_id)
is covered by
nc_form_view_v2_fk_view_id_index (fk_view_id)
On nc_gallery_view_columns_v2
nc_gallery_view_columns_v2_fk_view_id_index (fk_view_id)
is covered by
nc_gallery_view_columns_v2_fk_view_id_fk_column_id_index (fk_view_id, fk_column_id)
On nc_gallery_view_v2
nc_gallery_view_v2_oldpk_idx (fk_view_id)
is covered by
nc_gallery_view_v2_fk_view_id_index (fk_view_id)
On nc_grid_view_columns_v2
nc_grid_view_columns_v2_fk_view_id_index (fk_view_id)
is covered by
nc_grid_view_columns_v2_fk_view_id_fk_column_id_index (fk_view_id, fk_column_id)
On nc_grid_view_v2
nc_grid_view_v2_oldpk_idx (fk_view_id)
is covered by
nc_grid_view_v2_fk_view_id_index (fk_view_id)
On nc_integration_links_v2
nc_il_integration_idx (fk_integration_id)
is covered by
nc_integration_links_v2_fk_integration_id_base_id_unique (fk_integration_id, base_id)
On nc_kanban_view_columns_v2
nc_kanban_view_columns_v2_fk_view_id_index (fk_view_id)
is covered by
nc_kanban_view_columns_v2_fk_view_id_fk_column_id_index (fk_view_id, fk_column_id)
On nc_kanban_view_v2
nc_kanban_view_v2_oldpk_idx (fk_view_id)
is covered by
nc_kanban_view_v2_fk_view_id_index (fk_view_id)
On nc_list_view_columns_v2
nc_outline_view_columns_v2_fk_view_id_index (fk_view_id)
is covered by
nc_outline_view_columns_v2_fk_view_id_fk_column_id_index (fk_view_id, fk_column_id)
On nc_managed_app_deployment_logs
nc_sandbox_deployment_logs_base_id_idx (base_id)
is covered by
nc_sandbox_deployment_logs_base_created_idx (base_id, created_at)
On nc_managed_app_versions
nc_managed_app_versions_managed_app_id_idx (fk_managed_app_id)
is covered by
nc_managed_app_versions_status_idx (fk_managed_app_id, status)
On nc_managed_app_versions
nc_managed_app_versions_ordering_idx (fk_managed_app_id, version_number)
is covered by
nc_managed_app_versions_number_unique_idx (fk_managed_app_id, version_number)
On nc_managed_apps
nc_sandboxes_base_id_idx (base_id)
is covered by
nc_sandboxes_base_id_unique (base_id)
On nc_map_view_columns_v2
nc_map_view_columns_v2_fk_view_id_index (fk_view_id)
is covered by
nc_map_view_columns_v2_fk_view_id_fk_column_id_index (fk_view_id, fk_column_id)
On nc_map_view_v2
nc_map_view_v2_oldpk_idx (fk_view_id)
is covered by
nc_map_view_v2_fk_view_id_index (fk_view_id)
On nc_model_stats_v2
nc_model_stats_v2_fk_workspace_id_index (fk_workspace_id)
is covered by
nc_model_stats_v2_pkey (fk_workspace_id, base_id, fk_model_id)
On nc_oauth_authorization_codes
nc_oauth_authorization_codes_code_index (code)
is covered by
nc_oauth_authorization_codes_pkey (code)
On nc_oauth_authorization_codes
nc_oauth_authorization_codes_fk_client_id_index (fk_client_id)
is covered by
nc_oauth_authorization_codes_fk_client_id_fk_user_id_index (fk_client_id, fk_user_id)
On nc_oauth_tokens
nc_oauth_tokens_fk_client_id_index (fk_client_id)
is covered by
nc_oauth_tokens_fk_client_id_fk_user_id_index (fk_client_id, fk_user_id)
On nc_oauth_tokens
nc_oauth_tokens_is_revoked_index (is_revoked)
is covered by
nc_oauth_tokens_is_revoked_access_token_expires_at_index (is_revoked, access_token_expires_at)
On nc_principal_assignments
nc_principal_assignments_principal_idx (principal_type, principal_ref_id)
is covered by
nc_principal_assignments_principal_resource_idx (principal_type, principal_ref_id, resource_type)
On nc_principal_assignments
nc_principal_assignments_resource_idx (resource_type, resource_id)
is covered by
nc_principal_assignments_pk (resource_type, resource_id, principal_type, principal_ref_id)
On nc_principal_assignments
nc_principal_assignments_resource_principal_type_idx (resource_type, resource_id, principal_type)
is covered by
nc_principal_assignments_pk (resource_type, resource_id, principal_type, principal_ref_id)
On nc_record_templates
nc_record_templates_base_id_index (base_id)
is covered by
nc_record_templates_pkey (base_id, id)
On nc_teams
nc_teams_scim_external_id_idx (scim_external_id)
is covered by
nc_teams_scim_external_id_unique (scim_external_id)
On product_images
idx_product_images_product_id (product_id)
is covered by
idx_product_images_primary (product_id, is_primary)
On product_images
idx_product_images_product (product_id)
is covered by
idx_product_images_primary (product_id, is_primary)
On product_images
idx_product_images_primary (product_id, is_primary)
is covered by
idx_product_images_listing (product_id, is_primary, variant_id)
On product_images
idx_product_images_variant (variant_id)
is covered by
idx_images_variant_order (variant_id, sort_order)
On products
idx_products_brand_id (brand_id)
is covered by
idx_products_brand_price_compound (brand_id, base_price)
On products
idx_products_category_id (category_id)
is covered by
idx_products_cat_price_compound (category_id, base_price)
On products
idx_products_category (category_id)
is covered by
idx_products_cat_price_compound (category_id, base_price)
On products
idx_products_cat_price_compound (category_id, base_price)
is covered by
idx_products_cat_price (category_id, base_price)
On products
idx_products_id (id)
is covered by
products_pkey (id)
On products
idx_products_title_search (title gin_trgm_ops)
is covered by
idx_products_search (title gin_trgm_ops, description gin_trgm_ops)

Slow Queries

Slow queries take 20 ms or more on average and have been called at least 100 times.

Explain queries to see where to add indexes.

Total Time Average Time Calls
0 min 36% 41 ms 227 imeagleangel
SELECT schemaname AS schema, t.relname AS table, ix.relname AS name, regexp_replace(pg_get_indexdef(i.indexrelid), $1, $2) AS columns, regexp_replace(pg_get_indexdef(i.indexrelid), $3, $4) AS using, indisunique AS unique, indisprimary AS primary, indisvalid AS valid, indexprs::text, indpred::text, pg_get_indexdef(i.indexrelid) AS definition FROM pg_index i INNER JOIN pg_class t ON t.oid = i.indrelid INNER JOIN pg_class ix ON ix.oid = i.indexrelid LEFT JOIN pg_stat_user_indexes ui ON ui.indexrelid = i.indexrelid WHERE schemaname IS NOT NULL ORDER BY 1, 2 /*pghero*/