Output Formats
sxs streams data in both SDMX and native analytical formats. The format is
selected with the format query parameter or the Accept header.
Supported formats
json is the default when no format parameter or recognized Accept header
is provided.
Choosing a format
Use the format query parameter:
Or use the Accept header:
Common query parameters:
dimensionAtObservation=AllDimensionsreturns a flat observation layout; a specific dimension (by default the time dimension) returns series.measures=all|none|<list>selects measures.attributes=all|none|dsd|msd|<list>selects attributes.c[COMPONENT]=valuefilters components.limit,offsetandsortpage and order the result.- Range requests return a
Content-Rangeheader; series ranges count series, not observations.
JSON
SDMX-JSON is the default output. The V2 API returns SDMX-JSON 1.0; the V3 API returns the 2.x data message schema.
Example:
The response is a streamed SDMX data message:
JSON is convenient for SDMX clients and visualisation queries, but it is the most CPU-intensive format for very large downloads because every observation has to be parsed, built and serialized in JavaScript. Use native formats for bulk analytical extracts.
CSV
SDMX-CSV is available through:
format=csvfilewithlabels— always uses the SDMX-CSV formatter;format=csvorformat=csvfile— uses native CSV whenallowNativeCsvis enabled, otherwise falls back to the SDMX-CSV formatter.
The SDMX-CSV version follows the API version: SDMX-CSV 1.0 on the V2 API and SDMX-CSV 2.0 on the V3 API.
The SDMX-CSV layout contains the structure reference, ACTION, dimensions,
measures and attributes. The delimiter follows the request locale (comma for
English, semicolon for French, Spanish, German and Italian), unless the member
forces English column and decimal separators.
Example:
Native CSV
Native CSV lets ClickHouse format the CSV directly. It bypasses the JavaScript data builder and CSV formatter, which makes it dramatically faster for bulk downloads.
Enable it globally:
Or leave the global setting unset and enable it for specific spaces in the tenant configuration:
With native CSV enabled, format=csv and format=csvfile stream ClickHouse
CSVWithNames output. format=csvfilewithlabels remains on the SDMX-CSV
formatter.
Native CSV is not a drop-in replacement for SDMX-CSV:
- columns and layout come from the ClickHouse table and mapping, not from the SDMX-CSV specification;
- the content type is still
application/vnd.sdmx.data+csv, but the layout is not SDMX-CSV; - the default delimiter is
;unless the member forces English separators, in which case it is,; - the response can be larger than SDMX-CSV because it contains native columns.
In the phase 1 benchmark, native CSV processed 1M observations in 0.43 s (2.32M obs/s) versus 11.05 s for SDMX-CSV after the CSV formatter optimization (48.20 s before it). At 5M observations it took 1.76 s.
Use native CSV only for clients that have been designed for its column layout.
Parquet
Parquet is produced and streamed directly by ClickHouse:
It bypasses the JavaScript data builder and returns application/vnd.apache.parquet.
Parquet is columnar and compressed, so it is the most compact native format and
the best choice for analytical clients.
Example with DuckDB:
In the phase 1 benchmark, 1M observations took 0.27 s and produced 4.8 MB; 5M observations took 1.11 s and produced 24 MB. At 5M observations the Parquet response was 24 MB versus 342 MB for native CSV.
Parquet is not an SDMX format. Use it for analytical clients that can consume columnar data; JSON and SDMX-CSV remain the formats for standard SDMX clients.
ArrowStream
Apache Arrow is the emerging standard for large in-memory columnar data. By standardizing on a common binary interchange format, big data systems can reduce the costs and friction associated with cross-system communication.
To get observations in Arrow stream format, set format=arrowstream. The
response content type is application/vnd.apache.arrow.stream and is produced
directly by ClickHouse.
Example with DuckDB:
ArrowStream is suited to streaming large extracts into analytical tools. Like Parquet and native CSV, it bypasses the JavaScript SDMX builder.
Other native formats
format=arrow returns an Arrow IPC file and format=protobuf returns
ClickHouse-generated Protobuf. Both bypass the JavaScript builder and follow the
same native-format behaviour as Parquet and ArrowStream.
These formats are intended for integrations that need a compact binary representation, not for standard SDMX clients.
Classification, execution modes and resource profiles
sxs classifies SDMX data queries before sending them to ClickHouse. Two
independent decisions are made:
- execution mode —
main-looporworker; - resource profile —
normalorbulk.
The resource profile controls how ClickHouse executes the query. The execution mode controls where SDMX building and serialization run. See Execution modes and resource profiles.
Three settings drive the decisions:
Settings can be set globally or per space:
If the thresholds are absent they are infinite. The sample environment uses
WORKER_OBS_COUNT_LIMIT=50000 and BULK_OBS_COUNT_LIMIT=50000.
Classification rules
An all-dimensions request stays main-loop / normal when:
- its
limitis lower than or equal to both thresholds; - the dataset total observation count is lower than or equal to both thresholds;
- the filtered observation count is lower than or equal to both thresholds;
- it is a dimension-group-only request.
Otherwise the selected result is counted; for a limited request the selected
page is the classification size. The execution mode is worker when that size
exceeds WORKER_OBS_COUNT_LIMIT, and the resource profile is bulk when it
exceeds BULK_OBS_COUNT_LIMIT. A request can therefore be worker / normal
or main-loop / bulk. The full filtered count is still recorded in the worker
job for statistics and Content-Range.
Series requests always count their filtered observations, because a series
limit/offset pages series rather than observations. Series limit and
offset are honored but never capped. The same worker and bulk thresholds
apply.
includeHistory and updatedAfter force worker execution. They do not force the
bulk resource profile; the resource profile still depends on the result size.
Resource policy
Bulk concurrency is measured from bulk-resource worker jobs started within the
last eight hours. As the number of running worker jobs rises,
max_execution_speed is reduced:
Each bulk query also uses max_threads = 1 and
timeout_before_checking_execution_speed = 0.001. Bulk and worker details are
recorded in the worker_jobs collection for operational inspection.
Worker execution
Worker-eligible SDMX JSON and non-native SDMX-CSV requests are processed in a
bounded worker path. The worker may be local (node:worker_threads in the same
process) or remote (a wxs worker through the Mongo queue and callback). It
executes the ClickHouse query, builds the SDMX response and serializes JSON/CSV.
The main thread handles HTTP, backpressure, queueing and the worker-job record.
The worker-pool settings are process-global; they are read when the pool is created and are not overridden per space.
See Configuration and settings for the full reference.
When the queue is full, new worker jobs receive 429 Too Many Requests instead
of blocking the event loop or growing memory.
At 1M observations, the worker path keeps event-loop p99 at about 2.3 ms and fast-query p50 at about 98 ms:
The 1M runs include worker startup. SDMX CSV is faster than the main-thread path; JSON loses a small amount of throughput to cross-thread transfer but removes the event-loop impact.
Pool metrics (workers, busy, queued, started, completed, failed,
cancelled, recycled, rejected) are exposed by /healthcheck and /ready.
Workers are recycled after WORKER_POOL_MAX_JOBS jobs and capped by
WORKER_POOL_MEMORY_MB.
Worker scope covers requests above WORKER_OBS_COUNT_LIMIT and
history/updated-after requests. The worker runs the history/updated-after event
queries itself. Multi-dataset requests are not sent to workers; a multi-dataset
request containing a bulk-resource query or using history is rejected with
406. Native CSV, Parquet, Arrow, ArrowStream and Protobuf bypass both the
worker pool and the JavaScript SDMX builder.
See Bulk resource profile and worker jobs for the worker architecture, queueing, backpressure and full benchmark details.
Important notes
- The worker and bulk thresholds are classification thresholds, not hard
result caps. To keep a request in the main loop with normal resources, use a
limitat or below both thresholds. - Bulk and normal profiles apply
limit,offsetandsortto all-dimensions queries. Native formats also supportlimitandoffsetand are the better choice for bounded large extracts. - The resource profile changes ClickHouse resource usage. Worker execution moves SDMX row parsing, event processing and serialization off the main thread when worker offload is enabled. See Bulk download performance.
- Native formats — native CSV, Parquet, Arrow, ArrowStream and Protobuf — bypass this classification and the JavaScript SDMX builder. The thresholds apply to SDMX JSON and SDMX-CSV requests.
format=csvuses the native path whenallowNativeCsvis enabled. Otherwise it uses SDMX-CSV and is subject to classification.- A request that would require more than one bulk query is rejected with
406.
Bulk download performance
Phase 1 of the bulk-download optimization compared JSON, SDMX-CSV, native CSV and Parquet.
The measurements below were taken on a local test environment, not in production:
- 16 vCPU, 30 GiB RAM, Node.js 26
- Local MongoDB and ClickHouse
- Synthetic dataset: 3 dimensions, one time dimension and one measure
- Bulk resource forced with
bulkObsCountLimit = 2 - A fast
limit=1query sampled every 25 ms during the bulk download - Event-loop delay measured with
monitorEventLoopDelay
What this means
- SDMX-CSV is still the most expensive SDMX format. At 1M observations it takes 11.05 s, about 2.1× slower than JSON. The CSV formatter optimization reduced it from 48.20 s (4.4× faster) and lowered event-loop p99 from 59.5 ms to 14.8 ms, but fast-query latency is still ~348 ms versus ~96 ms idle.
- Native CSV is about 26× faster at 1M observations because ClickHouse formats and streams the CSV directly, bypassing the JavaScript data builder and CSV formatter. Before the formatter optimization it was 112× faster; event-loop impact is effectively removed on the native path.
- Parquet is the fastest and most compact native format. At 1M observations it takes 0.27 s and returns 4.8 MB; at 5M it takes 1.11 s and returns 24 MB. Its event-loop p99 is 4.0 ms and 11.5 ms respectively.
- JSON remains CPU-heavy. It reaches 93–94% event-loop utilization and increases fast-query latency by roughly 45–50%, but is far less severe than SDMX-CSV.
- All native formats bypass the JavaScript builder. CSV, Parquet and ArrowStream are produced by ClickHouse, so their cost is mostly database and network, not SDMX row transformation. Fast-query figures for the fastest native formats are based on fewer samples because the downloads are short.
Benchmark DSD
All measurements above use the minimal DSD defined in
src/server/tests/bulkBaseline.test.js:
The DSD has no attributes, codelists, dictionaries, multilingual components or
dimension groups. A first row (A,B,1,2020-01-01,1.5) is loaded through the
normal CSV path; the remaining rows are inserted directly into ClickHouse.
MD_ID is handled inline by the data builder rather than stored in a
dimension-value map, and DIM1, DIM2 and TIME_PERIOD each have one distinct
value. The benchmark therefore isolates row volume and serialization cost from
query complexity and high-cardinality metadata. It is not representative of a
production DSD with many dimensions, attributes and codelists.
Full benchmark methodology and results are in bench/BULK_BASELINE.md in the
repository. JSON and non-native SDMX-CSV remain the cases where worker-thread
offload is still needed.
