All locks
Queries with active locks
Showing 31 entries
Pid
Relname Transactionid Granted Query snippet Mode Age
1961041 pg_toast_16503 true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; AccessShareLock 0.000097 seconds
1961041 true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; ExclusiveLock 0.000097 seconds
1961041 pg_class true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; AccessShareLock 0.000097 seconds
1961041 pg_namespace true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; AccessShareLock 0.000097 seconds
1961041 pg_class_relname_nsp_index true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; AccessShareLock 0.000097 seconds
1961041 pg_class_tblspc_relfilenode_index true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; AccessShareLock 0.000097 seconds
1961041 oban_jobs true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; AccessShareLock 0.000097 seconds
1961041 pg_class_oid_index true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; AccessShareLock 0.000097 seconds
1961041 pg_namespace_oid_index true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; AccessShareLock 0.000097 seconds
1961041 pg_namespace_nspname_index true /* ECTO_PSQL_EXTRAS: Size of the tables (including indexes), descending by size */ SELECT n.nspname AS schema, c.relname AS name, pg_total_relation_size(c.oid) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND c.relkind IN ('r', 'm') ORDER BY pg_total_relation_size(c.oid) DESC; AccessShareLock 0.000097 seconds
1960926 true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; ExclusiveLock 0.-10991 seconds
1960926 pg_constraint_conparentid_index true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; AccessShareLock 0.-10991 seconds
1960926 pg_constraint_oid_index true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; AccessShareLock 0.-10991 seconds
1960926 pg_attribute_relid_attnum_index true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; AccessShareLock 0.-10991 seconds
1960926 pg_constraint true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; AccessShareLock 0.-10991 seconds
1960926 pg_constraint_contypid_index true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; AccessShareLock 0.-10991 seconds
1960926 pg_attribute_relid_attnam_index true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; AccessShareLock 0.-10991 seconds
1960926 pg_attribute true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; AccessShareLock 0.-10991 seconds
1960926 pg_constraint_conrelid_contypid_conname_index true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; AccessShareLock 0.-10991 seconds
1960926 pg_constraint_conname_nsp_index true /* ECTO_PSQL_EXTRAS: Foreign keys info for all tables */ SELECT conrelid::regclass::text AS table_name, conname AS constraint_name, a.attname AS column_name, confrelid::regclass::text AS foreign_table_name, af.attname AS foreign_column_name FROM pg_constraint AS c JOIN pg_attribute AS a ON a.attnum = ANY(c.conkey) AND a.attrelid = c.conrelid JOIN pg_attribute AS af ON af.attnum = ANY(c.confkey) AND af.attrelid = c.confrelid WHERE c.contype = 'f'; AccessShareLock 0.-10991 seconds
1960867 pg_tablespace true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 pg_stats true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 pg_attribute true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 pg_proc_oid_index true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 pg_index true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 pg_proc true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 pg_statistic true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 pg_namespace true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 pg_indexes true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 pg_class true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != AccessShareLock 0.0-9604 seconds
1960867 true /* ECTO_PSQL_EXTRAS: Find indexes with a high ratio of NULL values */ SELECT c.oid, c.relname AS index, pg_size_pretty(pg_relation_size(c.oid)) AS index_size, i.indisunique AS unique, a.attname AS indexed_column, CASE s.null_frac WHEN 0 THEN '' ELSE to_char(s.null_frac * 100, '999.00%') END AS null_frac, pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving FROM pg_class c JOIN pg_index i ON i.indexrelid = c.oid JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_class c_table ON c_table.oid = i.indrelid JOIN pg_indexes ixs ON c.relname = ixs.indexname LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname WHERE -- Primary key cannot be partial NOT i.indisprimary -- Exclude already partial indexes AND i.indpred IS NULL -- Exclude composite indexes AND array_length(i.indkey, 1) = 1 -- Exclude indexes without null_frac ratio AND coalesce(s.null_frac, 0) != ExclusiveLock 0.0-9604 seconds