fix: Remove photo_url index to support large base64 images
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

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:
2025-10-04 09:08:52 +00:00
parent 4527224933
commit 5c69375d7a

View File

@@ -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';