Tutorial: Use the SQL analytics endpoint for Microsoft Fabric HorizonDB

In this tutorial step, you validate Fabric HorizonDB mirroring and query the asynchronous analytical copy through the SQL analytics endpoint.

Important

Fabric HorizonDB is in public preview. Capabilities, limits, and behavior might change before general availability. For more information, see Microsoft Fabric preview features.

Prerequisites

  • Complete Query and inspect Fabric HorizonDB.
  • Confirm that horizon_sample.customers and horizon_sample.orders have primary keys and contain the tutorial rows.
  • Have read access to the SQL analytics endpoint and mirrored data.

The SQL analytics endpoint and PostgreSQL endpoint are separate. This step uses the PostgreSQL endpoint only to establish a source high-water mark. Run analytical queries against the SQL analytics endpoint.

Record the PostgreSQL source state

In the Fabric HorizonDB SQL editor, connect as the database creator and run:

SELECT
    count(*) AS source_order_count,
    max(order_id) AS source_latest_order_id,
    max(created_at) AS source_latest_created_at,
    sum(total) AS source_order_total
FROM horizon_sample.orders;

Record the result. For the unchanged tutorial data:

  • source_order_count is 3.
  • source_order_total is 2655.75.
  • The latest ID and timestamp identify the current source high-water mark.

Review mirroring

  1. Return to the workspace, locate the mirroring item associated with contoso-orders-db, and open its status experience.
  2. Locate horizon_sample.customers and horizon_sample.orders.
  3. Wait for the initial copy of both eligible tables to finish.
  4. Confirm that neither table reports a failed, blocked, or reseeding state.
  5. Record the last-applied, refresh, or lag information shown by the released experience.

The exact state labels can change during public preview. Database readiness doesn't mean the analytical copy is current.

If a table doesn't appear, confirm its key, columns, and recent DDL against Mirroring limitations.

Open the SQL analytics endpoint

  1. Return to the workspace or database analytical experience.
  2. Open the SQL analytics endpoint associated with contoso-orders-db.
  3. Confirm that the endpoint explorer shows the mirrored customer and order tables.
  4. Use the schema and table names displayed by the endpoint.
  5. Open a new query against the SQL analytics endpoint.

The mirrored schema name can differ from the PostgreSQL schema name, such as a transformed _public schema. Update the following examples to use the name displayed by your endpoint.

Query mirrored orders

Run:

SELECT
    order_reference,
    order_date,
    status,
    total,
    created_at
FROM horizon_sample.orders
ORDER BY order_date DESC, order_reference;

The result should contain the three tutorial orders after mirroring catches up.

Run an analytical aggregate:

SELECT
    status,
    COUNT(*) AS order_count,
    SUM(total) AS order_total
FROM horizon_sample.orders
GROUP BY status
ORDER BY status;

The unchanged tutorial data produces one row for completed, open, and processing.

Compare source and mirrored state

On the SQL analytics endpoint, run:

SELECT
    COUNT(*) AS mirrored_order_count,
    MAX(order_id) AS mirrored_latest_order_id,
    MAX(created_at) AS mirrored_latest_created_at,
    SUM(total) AS mirrored_order_total
FROM horizon_sample.orders;

Compare these values with the source values you recorded.

Small differences can be expected while committed changes are being applied. If the values don't converge:

  1. Stop changing the source tables while you collect a stable comparison.
  2. Check the table's mirroring status and lag information.
  3. Confirm that an initial copy or reseed isn't in progress.
  4. Verify table, key, column, type, and DDL eligibility.
  5. Follow Troubleshoot Fabric HorizonDB mirroring.

Don't describe the endpoint as transactionally current or synchronous. Include source timestamps in freshness-sensitive reports.

Verify read-only behavior

Use the SQL analytics endpoint for queries, semantic models, and reports. Don't attempt to insert, update, or delete mirrored Fabric HorizonDB rows through it.

Operational writes continue to use the PostgreSQL endpoint. Permissions on the PostgreSQL source and analytical copy are also separate.

Expected outcome

The SQL analytics endpoint shows the mirrored tutorial tables, returns three orders with a total of 2655.75, and reaches the same stable high-water mark as the PostgreSQL source after mirroring catches up.

Next step