Skip to content

feat: docs for pgwire clients #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1d5313b
feat: docs for pgwire clients
jerrinot May 2, 2025
39da602
javascript
jerrinot May 2, 2025
ff8506f
java
jerrinot May 2, 2025
393888a
c# guide
jerrinot May 5, 2025
0c9db55
php guide
jerrinot May 5, 2025
397f74f
rust guide
jerrinot May 5, 2025
66e6128
go guide
jerrinot May 5, 2025
87aea00
r guide
jerrinot May 5, 2025
441d46b
tweaks
jerrinot May 5, 2025
09c00b0
tweaks
jerrinot May 5, 2025
820f84d
python samples
jerrinot May 7, 2025
40017c2
rust samples
jerrinot May 7, 2025
930e962
tweaks
jerrinot May 7, 2025
fbe6bd1
javascript guide
jerrinot May 7, 2025
439eea2
pgjdbc
jerrinot May 9, 2025
cb83ac1
reactive java
jerrinot May 9, 2025
fd7b572
use explicit timezone
jerrinot May 9, 2025
517c4ff
.net
jerrinot May 9, 2025
c2e0387
Merge branch 'main' into jh_pgwire_guides
bluestreak01 May 9, 2025
73db7ec
golang
jerrinot May 9, 2025
d0fd0bd
php pass
jerrinot May 9, 2025
ae7c120
Merge remote-tracking branch 'origin/main' into jh_pgwire_guides
jerrinot May 9, 2025
c068af9
Merge remote-tracking branch 'refs/remotes/origin/jh_pgwire_guides' i…
jerrinot May 9, 2025
59396e6
simplify
jerrinot May 9, 2025
11f88a6
latest by -> latest on
jerrinot May 9, 2025
d9a2180
r
jerrinot May 9, 2025
9b44301
intro
jerrinot May 9, 2025
c72bfff
pythnon simplification
jerrinot May 9, 2025
c3d0271
javascript tweaks
jerrinot May 9, 2025
091fe9f
tweaks
jerrinot May 9, 2025
9b888b5
more tweaks
jerrinot May 9, 2025
5893bab
chapter about forward-only cursors
jerrinot May 9, 2025
5215d69
better structure
jerrinot May 9, 2025
636ffe7
broken link fixed
jerrinot May 9, 2025
827996c
ordering similar to ingestion reference
jerrinot May 9, 2025
f8caad4
<Clients> can display PGWire clients too
jerrinot May 9, 2025
29adba2
r logo
jerrinot May 9, 2025
67f470d
less is more
jerrinot May 9, 2025
5490339
less is more
jerrinot May 9, 2025
b87e7ce
less is more
jerrinot May 9, 2025
6364224
less is more
jerrinot May 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
820 changes: 820 additions & 0 deletions documentation/pgwire/c-sharp.md

Large diffs are not rendered by default.

872 changes: 872 additions & 0 deletions documentation/pgwire/go.md

Large diffs are not rendered by default.

1,150 changes: 1,150 additions & 0 deletions documentation/pgwire/java.md

Large diffs are not rendered by default.

792 changes: 792 additions & 0 deletions documentation/pgwire/javascript.md

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions documentation/pgwire/pgwire-intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: PGWire Client Overview
description:
QuestDB PGWire clients overview. Learn about the PGWire protocol and how to
use it with QuestDB.
---

import { Clients } from "../../src/components/Clients"

QuestDB implements the PostgreSQL wire protocol (PGWire) to allow clients to connect to QuestDB using PostgreSQL client
libraries. This is a great way to get started with QuestDB, as it allows you to use existing PostgreSQL clients and
libraries.

<Clients showProtocol="PGWire"/>

When using PGWire with QuestDB, there are a few important things to know and the rest of this document will cover them
in more detail.

### Querying vs. Ingestion

The PGWire interface is primarily recommended for querying data from
QuestDB. For data ingestion, especially for high-throughput scenarios, QuestDB recommends using its clients that
support the [InfluxDB Line Protocol (ILP)](/docs/ingestion-overview/). These are optimized for fast data insertion.

### Timestamp Handling

QuestDB stores all timestamps internally in [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
However, when transmitting timestamps over the PGWire protocol, QuestDB represents them as `TIMESTAMP WITHOUT TIMEZONE`.
This can lead to client
libraries interpreting these timestamps in their local timezone by default, potentially causing confusion or incorrect
data representation. Our language-specific guides provide detailed examples on how to configure your client to correctly
interpret these timestamps as UTC.

### PGWire vs. SQL Semantics

While QuestDB supports the PGWire protocol for communication, its SQL dialect and feature
set are not identical to PostgreSQL. QuestDB is a specialized time-series database and does not support all SQL
features, functions, or data types that a standard PostgreSQL server does. Always refer to the QuestDB SQL
documentation for supported operations.

### Forward-only Cursors

QuestDB's cursors are forward-only, differing from PostgreSQL's support for scrollable cursors (which allow
bidirectional navigation and arbitrary row access). With QuestDB, you can iterate through query results sequentially
from start to finish, but you cannot move backward or jump to specific rows. Explicit DECLARE CURSOR statements for
scrollable types, or operations like fetching in reverse (e.g., Workspace BACKWARD), are not supported.

This limitation can impact client libraries that rely on scrollable cursor features. For example, Python's psycopg2
driver might encounter issues if attempting such operations. For optimal compatibility, choose drivers or configure
existing ones to use forward-only cursors, such as Python's asyncpg driver.

### Protocol Flavors and Encoding

The PostgreSQL wire protocol has different implementations and options. When your
client library allows, prefer the Extended Query Protocol over the Simple Query Protocol. Additionally, for optimal
performance and type fidelity, choose clients that support BINARY encoding for data transfer over TEXT encoding
whenever possible. The specifics of how to configure this will vary by client library.
Loading