Captures the real query plan the server runs on your box, plus Postgres cache stats, so we can see why smart search is slow.
# Download the scripts
git clone https://gist.github.com/Deeds67/75bb0e5b2c1443402454068adb0cd102.git gallery-search-diag
cd gallery-search-diag
chmod +x *.sh
# 1. Turn on query plan logging (restarts Postgres)
./enable-auto-explain.sh
# 2. With GALLERY_SEARCH_TIMING=true still set on the server,
# run 3–4 smart searches in the UI.
# 3. Collect outputs
docker exec -i immich_postgres psql -U postgres -d immich < cache-stats.sql > cache-stats.txt
docker logs immich_postgres --since=10m > postgres.log
docker logs immich_server --since=10m > server.logSend cache-stats.txt, postgres.log, and server.log.
./disable-auto-explain.shAlso remove GALLERY_SEARCH_TIMING=true from your env once we're done.
Container names default to
immich_postgresand dbimmich. If yours differ, pass them:./enable-auto-explain.sh my_pg my_db.