This article records configuration and changes from a historical FastGPT release. Use it to understand that release, and consult the release notes for your installed and target versions before applying dependencies, configuration, or migration steps.
Prerequisite Configuration Adjustments
All provided commands use the default values from the official FastGPT Docker Compose template. If you modified the default PostgreSQL username, password, or database name, update all connection strings and SQL commands to match your custom credentials before starting the upgrade.
Step-by-Step Upgrade Workflow
- Update the pgvector image version in your
docker-compose.ymlfile to eitherankane/pgvector:v0.5.0orregistry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.5.0. - Pull the updated container image and restart the PostgreSQL service: ``
bash docker-compose pull && docker-compose up -d`` Wait for the container restart process to complete fully. - Access the interactive shell of the running PostgreSQL container: ``
bash docker exec -it pg bash`` - Connect to the default
postgresdatabase using your credentials: ``bash psql 'postgresql://username:password@localhost:5432/postgres'`Replaceusernameandpassword` with your actual database credentials if you customized them. - Execute the following SQL commands in the connected database session: ```sql -- Upgrade the installed vector extension ALTER EXTENSION vector UPDATE; -- Validate successful upgrade: confirm vector extension version is 0.5.0 \dx
-- Set maintenance memory for index building (1/4 of total system memory recommended) alter system set maintenanceworkmem = '2400MB'; select pgreloadconf();
-- Rebuild all database indexes and refresh collation versions REINDEX DATABASE postgres; ALTER DATABASE postgres REFRESH COLLATION VERSION;
-- Create concurrent HNSW vector index (do not cancel with Ctrl+C; close terminal when finished) CREATE INDEX CONCURRENTLY vectorindex ON modeldata USING hnsw (vector vectoripops) WITH (m = 16, efconstruction = 64);
```
Post-Upgrade Validation
To confirm the upgrade completed successfully:
- Reconnect to the PostgreSQL database if your session was disconnected.
- Run the
\dxcommand to verify thevectorextension version is now 0.5.0 (previously 0.4.2). - Run the
\d modeldatacommand to check the status of thevector_index: the output should show a valid HNSW index with noINVALIDsuffix, formatted asvector_index hnsw (vector vector_ip_ops) WITH (m='16', ef_construction='64').