Expand description
The promwrite format for COPY FROM STDIN: one Prometheus Remote
Write request body (v1 or v2), snappy- or zstd-compressed protobuf.
COPY FROM STDIN WITH (FORMAT promwrite [, version 2] [, <options>])
is a GreptimeDB-specific, binary format (wire format code 1).
The payload is byte-for-byte the body a Prometheus remote-write
client POSTs to /v1/prometheus/write — compression and protobuf
framing included — buffered until CopyDone and then completed
through the exact ingestion core that endpoint runs: the same
decode, validation, conversion, batched/prepared write paths and
context extensions, under the connection’s regular postgres query
context.
The WITH options carry what the HTTP endpoint takes as its
content-type/-encoding and query parameters; values already provided
by the postgres session (database, user) are not repeated:
version 1|2— the remote-write protocol version, matching the HTTP content-type’s proto (default1).zstd— the body uses zstd instead of the default snappy compression, matchingContent-Encoding: zstd.physical_table 'name'— the?physical_table=query parameter.pipeline_name/pipeline_version— the pipeline headers (v1 only; for v2 they are accepted and ignored by the core, exactly like the HTTP route — except that their presence still feeds the pipelines-with-exemplars restriction).
One COPY statement is one bounded ingestion request (see
crate::postgres::copy_in::COPY_IN_MAX_PAYLOAD_BYTES); the row
count includes samples, histograms and exemplars. With asynchronous v2
batching it reports accepted counts; COPY cannot distinguish HTTP 202
acceptance from completed writes or return partial counts on an error.
Structs§
- Prom
Write 🔒Options - The format’s validated options, carried to the flush that completes the copy through the shared remote-write ingestion core.