-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtemp_commit_msg2.txt
More file actions
38 lines (29 loc) · 1.15 KB
/
temp_commit_msg2.txt
File metadata and controls
38 lines (29 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[Cursor] Optimize RLS policies and remove duplicate indexes
Performance Improvements:
- Fixed 36 RLS policy performance issues across 12 tables
- Wrapped all auth.uid() calls in subqueries: (select auth.uid())
- Prevents auth function re-evaluation for each row
- Significantly improves query performance at scale
Policy Consolidation:
- Removed 6 duplicate RLS policies
- Consolidated final_cta policies (4 → 2)
- Consolidated waitlist policies (3 → 1)
- Reduces policy evaluation overhead
Index Optimization:
- Dropped 2 duplicate index constraints
- Removed notes_id_key (kept primary key)
- Removed documents_id_key (kept primary key)
- Reduces index maintenance overhead
Migration Applied:
- optimize_rls_policies_and_indexes_v2 (20251009093547)
Tables Optimized:
- api_keys, chats, code_generations, documents, files
- messages, models, notes, pdfs, user_keys
- final_cta, waitlist
Impact:
✅ 44 performance warnings resolved
✅ Database queries significantly faster at scale
✅ Better scalability for large datasets
Documentation:
- Updated SUPABASE_SECURITY_FIXES.md with performance improvements
- Updated .cursorrules with RLS optimization best practices