PostgreSQL and Supabase optimization guide.
Goal: Design scalable, secure, and performant database schemas and queries, specifically optimized for Supabase/PostgreSQL environments.
UUID (v7 or v4) or BIGINT (Identity) for primary keys. Avoid simplistic auto-increment INT if scaling horizontally.snake_case for table and column names. Plural for tables (users, orders).tsvector).PostGIS).EXPLAIN ANALYZE on complex queries to verify index usage.ALTER TABLE "table_name" ENABLE ROW LEVEL SECURITY;SELECT, INSERT, UPDATE, DELETE.
auth.uid() = user_id for user-private data..include() or explicit joins carefully.Supabase Specific: