Send Feedback
Skip to content

Introduction to Postgres SQL Interface (pgwire)

This page introduces the concepts, architecture, and typical use cases for integrating pgwire with your KDB‑X deployment.

pgwire is a lightweight proxy process that implements the PostgreSQL wire protocol (v3, both binary and text) to allow SQL clients to connect to a KDB-X instance as though it were a PostgreSQL-compatible database.

Each client connection corresponds to a single TCP connection to a KDB-X host running .s.init[], which handles incoming SQL requests.

pgwire is available for Windows, Linux, and macOS. You can deploy pgwire on:

  • The client machine, alongside the PostgreSQL client (for example, PowerBI, HeidiSQL, Tableau).
  • The server machine, alongside KDB-X (for example, the q and pgwire processes on the same Linux server).

Supported clients

pgwire connects successfully with the following client versions:

Client Version
Tableau 2021.4.1
HeidiSQL 11.3.0.6295
PowerBI 2.95 (July 2021)
DBVisualizer 13.0.2
Grafana 9.0.0

Note

We test and expand this list when we verify newer client versions. If your client works but doesn’t appear here, email us so we can add it to future updates.

How it works (architecture overview)

At a high level, pgwire sits between a PostgreSQL-compatible client and a running q process. It listens on a local or remote TCP port and relays SQL statements to the kdb host. This approach avoids dependency on heavyweight PostgreSQL components and allows SQL translation to remain consistent with the native q engine underneath.

Use cases

pgwire provides a simple bridge between KDB-X and widely used SQL tooling. Common use cases include:

  • Business Intelligence: Allow analysts to query KDB-X directly from BI tools without writing q.
  • Exploratory Analysis: Enable ad hoc access via DBVisualizer or pgAdmin.
  • Dashboards and Visualization: Integrate time-series queries into Grafana or Tableau.
  • Ad hoc reporting and data exports using Excel plug-ins or Power BI.

Protocol compatibility

pgwire supports PostgreSQL v3 wire protocol and translates incoming SQL queries into q expressions using the internal SQL parser (.s.init[]). However, it does not fully support some PostgreSQL features:

  • No support for multi-statement transactions (BEGIN, COMMIT)
  • Limited support for SQL dialects with vendor-specific extensions
  • No access to PostgreSQL system catalogs beyond what is emulated (for example, pg_tables, pg_type)

You may need to adjust PostgreSQL clients that inspect metadata to work with KDB‑X’s simplified schema model.

Next steps:

  • Configure and query KDB‑X using the pgwire quickstart guide.
  • Go through end-to-end examples, including integrations with Tableau and Power BI.
  • Check out a list of pgwire settings, functions, supported SQL syntax, and tuning parameters.