pgvector 0.8.0 + hnsw on azure postgresql flexible server stopped working

Sami Chkhachkhi 0 Reputation points
2025-08-21T12:42:45.84+00:00

Description: We are seeing queries fail in production after upgrading to pgvector 0.8.0

Query example:

WHERE (t."Embedding" <=> $1) < 0.6 ORDER BY t.c

Error output:

server process (PID 3853) was terminated by signal 4: Illegal instruction detail: Failed process was running terminating any other active server processes FATAL: the database system is in recovery mode

Environment:

pgvector version: 0.8.0

PostgreSQL version: 16.9 Location: Francecentral

Hosting: Azure Database for PostgreSQL [Flexible Server/Single Server]

Steps to reproduce:

Run a similarity query using <=> on a table with embeddings.

Observe crash with Illegal instruction.

Expected behavior: Query should return similarity results without crashing the server.

Actual behavior: Server process crashes and triggers recovery mode.

Notes:

Issue seems related to the upgrade from pgvector 0.7.x to 0.8.0.

GPT analysis:

Root Cause – CPU Instruction Incompatibility

The likely cause of these crashes is a CPU instruction mismatch between the pgvector extension and the underlying hardware. In pgvector 0.8.0, the extension was compiled with aggressive optimizations (using -march=native on some platforms) to leverage advanced CPU instructions for speed pgxn.org . This means the binary may include SIMD/vector instructions (e.g. AVX/AVX2) that are available on the build machine’s CPU. If the Azure DB server’s actual CPU does not support those specific instructions, any attempt to execute them will trigger an illegal instruction fault, crashing the server process

Happens consistently on production workloads.

Azure Database for PostgreSQL
{count} votes

1 answer

Sort by: Most helpful
  1. Kalyani Kondavaradala 1,015 Reputation points Microsoft External Staff Moderator
    2025-08-22T08:21:52.68+00:00

    Hi Sami Chkhachkhi,

    Thanks for posting your query on Microsoft Q&A!

    It looks like you're encountering some issues with pgvector after upgrading to version 0.8.0 on your Azure PostgreSQL Flexible Server. The error message you're seeing suggests that there may be a CPU instruction incompatibility. This often happens when the extension is compiled with optimizations that aren't supported by the underlying hardware, which can lead to the "Illegal instruction" error and crash the server process.

    Recommended approach

    Since the issue is binary-level incompatibility, try to roll back to the last known good version (0.7.x).

    Step 1 : Verify the crash in logs

    From Azure portal >Flexible Server > Logs, confirm entries such as:

    server process (PID 3853) was terminated by signal 4: Illegal instruction
    FATAL: the database system is in recovery mode
    

    Step 2 : Roll back pgvector to 0.7.x

    Connect to the database (via psql, Azure CLI, or Cloud Shell):

    psql "host=<your-server>.postgres.database.azure.com \
          port=5432 sslmode=require \
          dbname=<your-db> \
          user=<admin>@<your-server>"
    

    Then run:

    -- Remove the problematic version
    DROP EXTENSION IF EXISTS pgvector;
    -- Re-install the last stable version
    CREATE EXTENSION pgvector VERSION '0.7.1';
    

    (replace 0.7.1 with the version you were using before the upgrade)


    Step 3: Validate

    Re-run your similarity query:

    SELECT *FROM your_table t WHERE (t."Embedding" <=> $1) < 0.6 ORDER
    

    Note:

    1. Always validate extension upgrades in a staging environment with the same CPU class as production.
    2. Keep a rollback script handy for mission-critical workloads.
    3. Avoid re-upgrading to 0.8.0 until a compatible binary is provided.

    Once you tried it, please let us know if the previous version (0.7.x) work without any problems on the same server.

    pgvector 0.8.0 was built with CPU optimizations that require hardware instructions not supported on the CPUs running Azure Database for PostgreSQL Flexible Server in France Central. Because of that, the extension is not compatible in its current form and leads to crashes when those instructions are executed.

    Hope this helps! If it does, please upvote so others in the community can find it useful.

    Thanks,

    Kalyani


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.