feat: add user_id index to profiles table for faster lookups

The profiles table previously lacked an index on the user_id column, causing slow query performance when filtering by user. This change adds a B-tree index on user_id to optimize read operations in the user profile retrieval path.
This commit is contained in:
2026-06-09 21:11:37 +00:00
parent e698663975
commit a179a749dc
6 changed files with 35 additions and 15 deletions
+12 -4
View File
@@ -6,8 +6,10 @@ LOCUST_USERS ?= 20
LOCUST_SPAWN_RATE ?= 5
LOCUST_RUN_TIME ?= 120s
DEVPLACE_RATE_LIMIT ?= 1000000
TEST_WORKERS ?= auto
TEST_DIST ?= loadfile
.PHONY: install dev clean test test-headed coverage coverage-headed coverage-html locust locust-headless
.PHONY: install dev clean test test-serial test-headed test-headed-serial coverage coverage-headed coverage-html locust locust-headless
install:
pip install -e .
@@ -19,15 +21,21 @@ prod:
DEVPLACE_WEB_WORKERS=2 uvicorn devplacepy.main:app --host 0.0.0.0 --port 10500 --workers 2 --backlog 8192 --proxy-headers --forwarded-allow-ips '*'
test:
PLAYWRIGHT_HEADLESS=1 python -m pytest tests/ -v --tb=line -x
PLAYWRIGHT_HEADLESS=1 python -m pytest tests/ -n $(TEST_WORKERS) --dist $(TEST_DIST) --tb=line -x
test-serial:
PLAYWRIGHT_HEADLESS=1 python -m pytest tests/ -p no:xdist -v --tb=line -x
test-headed:
PLAYWRIGHT_HEADLESS=0 python -m pytest tests/ -v --tb=line -x
PLAYWRIGHT_HEADLESS=0 python -m pytest tests/ -n $(TEST_WORKERS) --dist $(TEST_DIST) --tb=line -x
test-headed-serial:
PLAYWRIGHT_HEADLESS=0 python -m pytest tests/ -p no:xdist -v --tb=line -x
coverage:
rm -f .coverage .coverage.*
COVERAGE_PROCESS_START=$(CURDIR)/.coveragerc PLAYWRIGHT_HEADLESS=1 \
python -m coverage run -m pytest tests/ -p no:xdist --tb=line
python -m coverage run -m pytest tests/ -n $(TEST_WORKERS) --dist $(TEST_DIST) --tb=line
python -m coverage combine
python -m coverage report