Azure HorizonDB Against PostgreSQL Flexible Server, Measured: Vector Search, Failover and Cost

Azure HorizonDB compared with Azure Database for PostgreSQL flexible server: failover time, vector search and price
On this page

Last week I wrote about choosing between Azure HorizonDB and Azure Database for PostgreSQL flexible server after HorizonDB reached general availability at Ignite. That article measured HorizonDB alone. This one puts the two services side by side: the same PostgreSQL version, the same table, the same 100,000 vectors, the same queries, and a client that keeps writing while each service fails over.

The short version. On vector search the two are the same engine and behave the same, to within a fraction of a millisecond. The difference is in what happens when a node dies: the HorizonDB client lost 9 to 10 seconds of writes, the flexible server client 34 to 37. HorizonDB costs about 56 percent more per vCore than a flexible server with the same memory, and getting a cluster running from the command line takes several steps the documentation does not mention.

Azure HorizonDB compared with Azure Database for PostgreSQL flexible server: vector search results, failover time and price per vCore, measured in Sweden Central
Two databases, one schema, one client, Sweden Central.

Test Setup

Both databases ran in Sweden Central with high availability across zones and two vCores per node. The client was Azure Cloud Shell in West Europe, about 25 ms away, which is why every client-side latency in this article starts at 25 ms. Server-side times come from EXPLAIN ANALYZE and leave the network out.

Flexible serverHorizonDB
ConfigurationGeneral Purpose D2ds_v5 (2 vCores, 8 GiB) with a zone-redundant standbyOne pool, 2 nodes of 2 vCores and 16 GiB, zone-redundant
EnginePostgreSQL 17.11PostgreSQL 17.11 (HorizonDB build)
pgvector / pg_diskann0.8.7 / 0.6.60.8.7 / 0.7.6
max_connections859128
shared_buffers2 GB9.4 GB
maintenance_work_mem211 MB128 MB
Time to readyUnder 18 minutes, standby includedCluster in 10 minutes or less, then the pool in 8 or less
Round trip from the client24.6 ms median25.2 ms median

The two are not memory-equal: a HorizonDB vCore comes with 8 GiB, a General Purpose flexible server vCore with 4. On a 159 MB table that made no difference to query times, and the cost section compares against the memory-optimized tier where it does matter. The low max_connections on HorizonDB is worth planning for, because built-in PgBouncer is one of the things the service does not have yet.

Sign-in on both used Microsoft Entra ID with a short-lived token, so the test involved no database passwords at all.

Provisioning from the Command Line

The portal creates a usable HorizonDB cluster in one form. The command line does not, and the gaps are instructive about how the service is put together.

StepFlexible serverHorizonDB
CreateOne command creates server, storage, standby and sign-inThe cluster command creates no compute, no sign-in method and public access disabled
ComputePart of createA separate pool; the command fails until a processor type and a compute generation number are supplied, neither marked as required in its help
Entra sign-inFlags on create, then one command to add an administratorNo command; two calls to the management API
Endpoint host nameDerived from the server nameNot returned by the API or the CLI; read from the portal overview page
Extension allow listOne parameter update, under two minutesA parameter group created and applied to the pool, 3 minutes 13 seconds
FailoverA CLI commandThe portal only, with the CLI extension I had

The Entra part is the one most likely to stop an automated deployment. With the CLI extension current at the time, enabling it took two requests against API version 2026-10-01-preview:

Bash14 lines
HID=$(az horizondb cluster show -g "$RG" -n "$CLUSTER" --query id -o tsv)
OID=$(az ad signed-in-user show --query id -o tsv)
TID=$(az account show --query tenantId -o tsv)

az rest --method put \
  --url "$HID/authentications/microsoftEntra?api-version=2026-10-01-preview" \
  --body '{"properties":{"state":"Enabled"}}'

az rest --method put \
  --url "$HID/microsoftEntraAdministrators/$OID?api-version=2026-10-01-preview" \
  --body "{\"properties\":{\"principalName\":\"labadmin\",\"principalType\":\"User\",\"tenantId\":\"$TID\"}}"

# The access token is the password; it is the same token for both services.
export PGPASSWORD=$(az account get-access-token --resource-type oss-rdbms --query accessToken -o tsv)

Until the administrator exists, the login fails with “password authentication failed”, which says nothing about Entra. Two smaller things cost me a failed command each. On the flexible server, --high-availability ZoneRedundant is no longer accepted and the flag is now --zonal-resiliency Enabled. On HorizonDB, CREATE EXTENSION vector still fails with an allow-list error that names “Azure Database for PostgreSQL”, as it did a week ago.

Vector Search with HNSW

The table holds 100,000 rows with a 384-dimension embedding and a tenant column with 50 values. The script builds the same HNSW index on both (m = 16, ef_construction = 64), then runs 200 queries for the 10 nearest neighbours and compares each result with an exact scan.

Unfiltered, hnsw.ef_searchFlexible: recallFlexible: server medianHorizonDB: recallHorizonDB: server median
400.9880.73 ms0.9780.63 ms
1000.9931.10 ms0.9831.01 ms
4000.9932.15 ms0.9881.77 ms

Index build took 29.4 seconds on the flexible server and 21.9 on HorizonDB, for a 195 MB index on each. The small recall difference is the two HNSW graphs being built independently, not a property of either service. HorizonDB was 10 to 20 percent faster on the server side in every row, which amounts to a tenth to a third of a millisecond and disappears behind a 25 ms round trip. With one run of each, I read these as “the same”.

Add a tenant filter and both show the behaviour that catches most teams once:

One tenant of 50, ef_search 40Rows returned (asked for 10)RecallServer median
Flexible, iterative scan off0.90.0890.75 ms
HorizonDB, iterative scan off0.90.0880.66 ms
Flexible, relaxed_order100.9923.09 ms
HorizonDB, relaxed_order100.9852.60 ms
⚠️
FILTERED HNSW RETURNS TOO FEW ROWS BY DEFAULT

With a selective filter and iterative scans off, the index returns its nearest candidates and the filter then discards most of them. A query for 10 rows returned fewer than one on average, on both services, with no error. Set hnsw.iterative_scan to relaxed_order (pgvector 0.8 or later) for filtered queries, and test with your real filter selectivity.

Vector Search with DiskANN

Both services ship Microsoft’s pg_diskann, and here the versions differ. The flexible server had 0.6.6, with two settings. HorizonDB had 0.7.6, with a dozen or more, among them a filter hook and selectivity thresholds for filter-aware search.

Flexible serverHorizonDB
Index build (178 MB)21.8 s33.6 s
Unfiltered, search list 40: recall / server median1.000 / 0.84 ms1.000 / 1.00 ms
Unfiltered, search list 4001.000 / 2.36 ms1.000 / 2.50 ms
One tenant of 50, search list 4010 rows, 0.999, 3.32 ms10 rows, 1.000, 3.43 ms
Plan for the filtered queryIndex scan with iterative searchCustom scan (filter-aware DiskANN)

DiskANN returned all 10 rows under the tenant filter on both services without any setting changed, because its iterative search is on by default. The newer extension on HorizonDB planned the filtered query differently and produced the same answer in about the same time. A 2 percent filter over 100,000 rows may be too easy to separate the two approaches; I would expect a gap to appear, if it does, at millions of rows and tighter filters, and I did not test that.

Build times went the other way from HNSW: the flexible server was faster here. Taken together, the two index builds say the services are comparable at this size and nothing more.

Failover from the Client

This is where the architectures differ. A flexible server standby is a second PostgreSQL server kept current by synchronous replication, and failover promotes it. HorizonDB nodes share a zone-redundant log and storage service; the documentation says a replica does not receive the log from the primary, so a promoted node has no replay backlog of its own.

The probe is a loop that commits one small insert every 250 ms, with a 3-second connect timeout and no pooling, and logs how long it went without a successful write.

Python21 lines
while time.time() < end:
    tick = time.time()
    try:
        if conn is None or conn.closed:
            conn = connect(target, timeout=3)
        n += 1
        conn.execute("insert into lab_probe (n) values (%s)", (n,))        # autocommit: one committed write
        if outage_started is not None:
            outages.append(time.time() - last_ok)                          # the gap a client actually saw
            outage_started, failures = None, 0
        last_ok = time.time()
    except Exception as error:
        failures += 1
        outage_started = outage_started or time.time()
        try:
            if conn is not None:
                conn.close()
        except Exception:
            pass
        conn = None                                                        # reconnect through the same endpoint
    time.sleep(max(0.0, 0.25 - (time.time() - tick)))

That is the core of the function in the sample with its logging removed.

RunNo successful write forFailed attemptsManagement operation
Flexible server, forced37.3 s815 min 13 s
Flexible server, forced36.7 s745 min 11 s
Flexible server, planned34.4 s565 min 10 s
HorizonDB9.9 s16More than a minute
HorizonDB8.7 s12Not timed
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#FFF3E0','primaryTextColor':'#232F3E','primaryBorderColor':'#FF9900','lineColor':'#232F3E','signalColor':'#0073BB','signalTextColor':'#0F172A','actorBkg':'#FFF3E0','actorBorder':'#FF9900','actorTextColor':'#232F3E','noteBkgColor':'#FFF8E7','noteBorderColor':'#FF9900','noteTextColor':'#232F3E'}}}%%
sequenceDiagram
    participant C as Client (write every 250 ms)
    participant E as Read-write endpoint
    participant N as New primary
    C->>E: INSERT, committed
    Note over E: Failover starts
    C-xE: Connection dropped (SSL EOF)
    C-xE: Reconnect refused or timed out
    Note over N: Standby promoted, endpoint moved
    C->>E: Reconnect
    E->>N: Routed to the new primary
    N-->>C: INSERT, committed
    Note over C: Gap: 9 to 10 s HorizonDB, 34 to 37 s flexible server

On both services the connection string did not change, the client reconnected through the same host name, and no acknowledged write was lost: every row the probe had been told was committed was there afterwards, and the only missing sequence numbers were attempts that had failed. That matches what both sets of documentation promise.

Three observations from the runs:

  • Planned was not gentler than forced on the flexible server. The planned failover cost 34.4 seconds of writes against 36.7 and 37.3 for forced. A maintenance window is a 35-second outage for writers either way.
  • The management operation is not the outage. The flexible server command took over five minutes to return each time, while the client was writing again after 37 seconds. The HorizonDB failover page makes the same point and tells you to measure from the application. Do that, and do not put the portal’s duration in a recovery-time report.
  • HorizonDB offered one kind of failover. The documentation describes planned and forced operations. The portal dialog I got had a single action, “Fail over to standby node”, described as stopping the read-write node immediately.
⚠️
RETRY LOGIC REQUIRED ON BOTH

Neither service hides a failover from the application. For 9 seconds or for 37, every write fails, first with a dropped connection and then with refused or timed-out reconnects. A client without retry and backoff turns that into user-visible errors on either service; the faster failover only shortens the window.

Cost

List prices for Sweden Central in euro, from Microsoft’s Retail Prices API. HorizonDB is pay-as-you-go only.

MeterFlexible serverHorizonDB
Compute per vCore-hour0.0852 General Purpose (4 GiB per vCore); 0.1171 Memory Optimized (8 GiB per vCore)0.1832 (8 GiB per vCore)
Storage per GB-month0.1248, provisioned0.2357, used
Backup per GB-month0.0939 (locally redundant)0.1085
The test configuration, compute per hour0.34 (2 x 2 vCores, General Purpose)0.73 (2 x 2 vCores)
The same per 730-hour monthAbout 249About 535

Per vCore with the same memory, HorizonDB is about 56 percent more than the memory-optimized flexible server. Against the General Purpose tier I actually ran, it is a little over twice the price, for twice the memory. Storage is nearly double per gigabyte, though HorizonDB bills what is used and the flexible server bills what is provisioned, so a half-empty disk narrows the gap.

Two structural points matter more than the rates. A flexible server standby is paid for and does nothing but wait; a HorizonDB second node also serves reads through the read-only endpoint, so the high-availability premium buys read capacity. And HorizonDB scales readers to 15 nodes on the same storage, where the flexible server needs read replicas with their own storage and replication lag. If the workload has read traffic to move, some of that 56 percent comes back.

The price list also carries HorizonDB meters named “1 vCore Free Tier” and “Storage – Free Tier” at zero. I found no page describing a free tier and did not try to create one.

Decision Guidance

%%{init: {'theme':'base','themeVariables':{'primaryColor':'#FFF3E0','primaryTextColor':'#232F3E','primaryBorderColor':'#FF9900','lineColor':'#232F3E','clusterBkg':'#F8FAFC','clusterBorder':'#CBD5E1','edgeLabelBackground':'#FFFFFF','nodeTextColor':'#232F3E'}}}%%
flowchart TD
    A["PostgreSQL workload on Azure"] --> B{"Is a 35-second write outage
during failover acceptable?"} B -->|No| C["HorizonDB:
about 10 s in this test"] B -->|Yes| D{"Need VNet injection, PgBouncer,
or a region HorizonDB lacks?"} D -->|Yes| E["Flexible server"] D -->|No| F{"Read traffic that a second
node could serve?"} F -->|Yes| C F -->|No| G["Flexible server:
lower cost for the same engine"] C --> H["Budget 128 connections per 2 vCores
and an external pooler"] classDef compute fill:#FFF3E0,stroke:#FF9900,stroke-width:2px,color:#232F3E classDef db fill:#EBF8FF,stroke:#0073BB,stroke-width:2px,color:#004C74 classDef store fill:#F0FFF4,stroke:#1D8102,stroke-width:2px,color:#145202 classDef mesh fill:#F3E8FF,stroke:#7C3AED,stroke-width:2px,color:#4C1D95 class A,B,D,F compute class C,H db class E,G store
  • Vector search is not the deciding factor. Same pgvector, near-identical results. Choose on availability, read scaling, networking and cost.
  • Failover time is. If the recovery-time target for writes is under 30 seconds, the flexible server did not meet it in three attempts and HorizonDB met it twice.
  • Connections need a plan on HorizonDB. 128 on a 2-vCore node, and no built-in pooler. Put PgBouncer or an application-side pool in the design from the start.
  • Automate HorizonDB with the management API in mind. The CLI did not cover sign-in, endpoints or failover. Expect to call the API directly, and to revisit the scripts as the extension catches up.
  • Keep the filtered-search setting in the migration checklist. It is the same trap on both, so it moves with the application.

Recommendation

For a new system where write availability matters and the region list fits, I would now start with HorizonDB: the failover result is a real, repeatable difference, and the second node earns part of its cost by serving reads. For an existing flexible server that meets its recovery target, there is no query-performance reason to move, and the price and tooling say wait. In both cases, measure failover yourself with a writing client before putting a number in a design document; the figure on the portal is not the one your users will see.

A note on testing: I ran everything from Azure Cloud Shell in West Europe against two databases in Sweden Central, each with two vCores per node and high availability across zones. The data set is synthetic: 100,000 vectors with 384 dimensions, built from a 16-dimension mixture so that neighbours have structure, and 200 queries from the same distribution. Query results are from one run on each service; failover was run twice on HorizonDB, and on the flexible server twice forced and once planned. Two faults of my own cost a rerun each. The first query run reported perfect recall because the Python driver had prepared the statement while index scans were disabled, and the cached plan was reused. My first vectors had noise in every dimension, which gave HNSW a recall of 0.2 to 0.4 that described the data and not the databases. Both are fixed in the sample. I did not test larger data, concurrency, write throughput, read scaling on the second node, a zone outage (a requested failover is not one), a HorizonDB planned failover, Private Link, restore, or the free tier meters. Prices are list prices from the Retail Prices API and not from an invoice. Host names, subscription and tenant identifiers are left out, and the resource group was deleted afterwards.

References & Further Reading


Discover more from C4: Container, Code, Cloud & Context

Subscribe to get the latest posts sent to your email.

Written by

Nithin Mohan TK

Hello Namaste! 👋🏻 I'm an accomplished Enterprise Solution Architect & Engineering Leader with 20+ years of progressive experience architecting, building, and scaling transformative enterprise solutions. ⚜️ Solution Architect / AI & Cloud 📌 Galway, Ireland

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.