Download supabase/CHECK_INDEXES.sql from Kyrlos11/nniback: direct link, hf CLI and curl.
- Browser
- Download file 1.71 kB
-
https://huggingface.co/spaces/Kyrlos11/nniback/resolve/main/supabase/CHECK_INDEXES.sql
- Command line
-
hf download hf://spaces/Kyrlos11/nniback/supabase/CHECK_INDEXES.sql
-
curl -L -o CHECK_INDEXES.sql https://huggingface.co/spaces/Kyrlos11/nniback/resolve/main/supabase/CHECK_INDEXES.sql
1.71 kB
| -- Check if all RLS optimization indexes exist | |
| -- Returns TRUE if all exist, FALSE if any are missing | |
| SELECT | |
| CASE | |
| WHEN COUNT(*) = 10 THEN TRUE | |
| ELSE FALSE | |
| END AS all_indexes_exist, | |
| COUNT(*) AS indexes_found, | |
| 10 AS indexes_expected, | |
| ARRAY_AGG(indexname ORDER BY indexname) AS existing_indexes | |
| FROM pg_indexes | |
| WHERE schemaname = 'public' | |
| AND indexname IN ( | |
| 'idx_agents_is_public_account_id', | |
| 'idx_agents_account_id_is_public', | |
| 'idx_projects_is_public_account_id', | |
| 'idx_projects_account_id_is_public', | |
| 'idx_threads_is_public_account_id', | |
| 'idx_threads_account_id_is_public', | |
| 'idx_messages_thread_id_created_at', | |
| 'idx_file_uploads_account_id_created_at', | |
| 'idx_agent_templates_is_public_creator_id', | |
| 'idx_credit_ledger_account_id' | |
| ); | |
| -- Alternative: Check each index individually | |
| -- Uncomment below to see which specific indexes are missing | |
| /* | |
| SELECT | |
| index_name, | |
| CASE | |
| WHEN EXISTS ( | |
| SELECT 1 FROM pg_indexes | |
| WHERE schemaname = 'public' | |
| AND indexname = index_name | |
| ) THEN '✓ EXISTS' | |
| ELSE '✗ MISSING' | |
| END AS status | |
| FROM ( | |
| VALUES | |
| ('idx_agents_is_public_account_id'), | |
| ('idx_agents_account_id_is_public'), | |
| ('idx_projects_is_public_account_id'), | |
| ('idx_projects_account_id_is_public'), | |
| ('idx_threads_is_public_account_id'), | |
| ('idx_threads_account_id_is_public'), | |
| ('idx_messages_thread_id_created_at'), | |
| ('idx_file_uploads_account_id_created_at'), | |
| ('idx_agent_templates_is_public_creator_id'), | |
| ('idx_credit_ledger_account_id') | |
| ) AS idx(index_name) | |
| ORDER BY index_name; | |
| */ | |