fix: Remove photo_url index to support large base64 images
PostgreSQL has an 8KB index size limit. Base64 images (even after compression) easily exceed this limit, causing errors like: "index row requires 2141448 bytes, maximum size is 8191" Solution: - Dropped idx_users_photo_url index from users table - Updated V008 migration to not create the index - Added comment explaining why no index is needed The photo_url column is rarely queried directly, so a full table scan when needed is acceptable. Photos are typically loaded via user_id lookups. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
ALTER TABLE users
|
||||
ADD COLUMN IF NOT EXISTS photo_url TEXT;
|
||||
|
||||
-- Create index for faster photo lookups
|
||||
CREATE INDEX IF NOT EXISTS idx_users_photo_url ON users(photo_url) WHERE photo_url IS NOT NULL;
|
||||
-- Note: No index on photo_url because base64 images exceed PostgreSQL's 8KB index limit
|
||||
-- Queries by photo_url are rare, so full table scan is acceptable
|
||||
|
||||
-- Add comment
|
||||
COMMENT ON COLUMN users.photo_url IS 'User profile photo - can be base64 data URL or external URL';
|
||||
|
||||
Reference in New Issue
Block a user