perf(immich): restore PostgreSQL vector search optimizations

- shared_buffers: 1GB → 2GB (clip_index is 452MB, needs headroom)
- effective_cache_size: 1536MB → 2560MB
- PG memory: 2Gi → 3Gi to support larger shared_buffers
- Add pg_prewarm to shared_preload_libraries with autoprewarm
- First search after restart: 999ms → 25ms
This commit is contained in:
Viktor Barzin 2026-04-11 10:30:44 +01:00
parent 5afef4c83e
commit 160e8980e5

View file

@ -448,10 +448,10 @@ resource "kubernetes_deployment" "immich-postgres" {
resources {
requests = {
cpu = "100m"
memory = "2Gi"
memory = "3Gi"
}
limits = {
memory = "2Gi"
memory = "3Gi"
}
}
}
@ -461,9 +461,12 @@ resource "kubernetes_deployment" "immich-postgres" {
command = ["sh", "-c", <<-EOT
cat > /data/postgresql.override.conf <<'PGCONF'
# Immich vector search performance tuning
shared_buffers = 1024MB
effective_cache_size = 1536MB
shared_buffers = 2048MB
effective_cache_size = 2560MB
work_mem = 64MB
shared_preload_libraries = 'vchord.so, vectors.so, pg_prewarm'
pg_prewarm.autoprewarm = on
pg_prewarm.autoprewarm_interval = 300
PGCONF
EOT
]