Azure Database for PostgreSQL flexible server crashes with vector 0.8.0

Luka K 0 Reputation points
2025-06-17T17:12:13.8033333+00:00

Hi,

Recently i created a Azure Database for PostgreSQL flexible server in my azure account. PostgreSQL version : 16.9 Availability zone: 2 Configuration: Burstable, B1ms, 1 vCores, 2 GiB RAM, 32 GiB storage High availability: Not enabled Location: North Europe

I also enabled vector and uuid-ossp in azure.extensions.

> \dx
                              List of installed extensions
   Name    | Version |   Schema   |                     Description                      
-----------+---------+------------+------------------------------------------------------
 plpgsql   | 1.0     | pg_catalog | PL/pgSQL procedural language
 uuid-ossp | 1.1     | public     | generate universally unique identifiers (UUIDs)
 vector    | 0.8.0   | public     | vector data type and ivfflat and hnsw access methods

Here is my problem:

> \d doc_44061291caacca00f1b4cb492ab201be
      Table "public.doc_44061291caacca00f1b4cb492ab201be"
Column    |          Type          | Collation | Nullable | Default 
```--------------+------------------------+-----------+----------+---------
 document_id  | character varying(255) |           | not null | 
 chunk_id     | integer                |           | not null | 
 page_content | text                   |           | not null | 
 metadata     | jsonb                  |           |          | 
 embedding    | vector(1536)           |           |          | 
Indexes:
    "doc_44061291caacca00f1b4cb492ab201be_pkey" PRIMARY KEY, btree (document_id, chunk_id)
    "idx_doc_44061291caacca00f1b4cb492ab201be_embedding" hnsw (embedding vector_cosine_ops) WITH (m='16', ef_construction='64')

> INSERT INTO doc_b0fc103cba3a6975a62ac244e90fc52a (document_id, chunk_id, page_content, metadata, embedding)
VALUES (
  'doc-123',
  1,
  'Test chunk for halfvec insert',
  '{"source": "test"}',
  (
    ARRAY[
      0.1, 0.2, 0.3, 0.4
    ] || ARRAY_FILL(0.0::float4, ARRAY[3068])
  )::halfvec
)
ON CONFLICT (document_id, chunk_id) DO UPDATE
SET
  page_content = EXCLUDED.page_content,
  metadata = EXCLUDED.metadata,
  embedding = EXCLUDED.embedding;
SSL SYSCALL error: EOF detected
The connection to the server was lost. Attempting reset: Failed.
The connection to the server was lost. Attempting reset: Failed.

And this is from logs: 2025-06-17 16:34:29 UTC-684c13ee.6-LOG: server process (PID 302290) was terminated by signal 4: Illegal instruction

On the other hand, 2 months ago i went through the same process of creating Azure Database for PostgreSQL flexible server and on that database same insert works fine. Here are details of that database (only minor version and availability zone are different): PostgreSQL version : 16.8 Availability zone: 1 Configuration: Burstable, B1ms, 1 vCores, 2 GiB RAM, 32 GiB storage High availability: Not enabled Location: North Europe

I suppose different CPU is used on the first one so it can not handle instructions properly. Can i update vector version or something? What would be your solution? I have to stay on this service (i can not switch to VM nor k8s).BR,

Luka

Azure Database for PostgreSQL
{count} votes

3 answers

Sort by: Most helpful
  1. Sai Raghunadh M 4,570 Reputation points Microsoft External Staff Moderator
    2025-06-17T18:56:43.9666667+00:00

    Hi @ Luka K

    Thanks for your detailed message.

    The issue you're seeing is likely caused by the vector extension (version 0.8.0) using CPU instructions that aren't supported on the specific hardware behind your current PostgreSQL Flexible Server.

    Here’s what you can do:

    You mentioned it worked before in Availability Zone 1 — try creating a new Flexible Server there. The hardware in that zone likely supports the instructions used by the extension.

    Since this is a managed service, extensions like vector are maintained by Azure. You can't manually update or downgrade them, but we’re here to help with workarounds.

    If you continue having issues with HNSW, Azure also supports another index type called DiskANN, which is more stable and production-ready for vector search.

    Here are some helpful links:

    Use pgvector in Azure PostgreSQL

    Use DiskANN indexing

    Hope this helps. Do let us know if you any further queries.

    1 person found this answer helpful.

  2. Sami Chkhachkhi 0 Reputation points
    2025-08-21T12:39:37.0966667+00:00

    We're experiencing the same issue on our production load

    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.

    0 comments No comments

  3. Luka K 0 Reputation points
    2025-09-23T15:58:41.9433333+00:00

    Now it's not even working always in zone 1 (sometime yes, sometime no). Is there any proper resolution or workaround for this? I have to use vector extension.

    0 comments No comments

Your answer

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