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

formatOutputFamilyNotes
jsonSDMX-JSONSDMXDefault format; streamed
csv / csvfileSDMX-CSV or native CSVSDMX / nativeNative CSV when enabled, otherwise SDMX-CSV
csvfilewithlabelsSDMX-CSV with labelsSDMXAlways uses the SDMX-CSV formatter
parquetApache ParquetNativeColumnar, compressed, produced by ClickHouse
arrowstreamApache Arrow IPC streamNativeStreamed, produced by ClickHouse
arrowApache Arrow IPC fileNativeProduced by ClickHouse
protobufProtobufNativeProduced by ClickHouse
XMLSDMX-XMLSDMXPartially implemented and experimental

json is the default when no format parameter or recognized Accept header is provided.

Choosing a format

Use the format query parameter:

GET /{space}/sdmx/data/dataflow/{agencyID}/{id}/{version}
  ?dimensionAtObservation=AllDimensions
  &format=json

Or use the Accept header:

AcceptResult
application/jsonSDMX-JSON
application/vnd.sdmx.data+csvNative CSV when enabled, otherwise SDMX-CSV
application/vnd.sdmx.data+xmlSDMX-XML (experimental)

Common query parameters:

  • dimensionAtObservation=AllDimensions returns 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]=value filters components.
  • limit, offset and sort page and order the result.
  • Range requests return a Content-Range header; 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:

curl "$sxs/collect/sdmx/data/dataflow/ECB/EXR/1.0.4?dimensionAtObservation=AllDimensions&format=json&limit=1000"

The response is a streamed SDMX data message:

{
  "data": {
    "dataSets": [
      {
        "observations": {
          "0:0:0": [1.23, null]
        }
      }
    ],
    "structures": [
      {
        "dimensions": {},
        "measures": {}
      }
    ]
  },
  "meta": {}
}

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=csv or format=csvfile — uses native CSV when allowNativeCsv is 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:

curl "$sxs/collect/sdmx/data/dataflow/ECB/EXR/1.0.4?dimensionAtObservation=AllDimensions&format=csvfilewithlabels"

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:

ALLOW_NATIVE_CSV=true

Or leave the global setting unset and enable it for specific spaces in the tenant configuration:

{
  "allowNativeCsv": true
}

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:

curl "$sxs/collect/sdmx/data/dataflow/ECB/EXR/1.0.4?dimensionAtObservation=AllDimensions&format=parquet"

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:

INSTALL httpfs;
LOAD httpfs;

SELECT *
FROM read_parquet('https://<sxs-host>/collect/sdmx/data/dataflow/ECB/EXR/1.0.4?dimensionAtObservation=AllDimensions&format=parquet')
LIMIT 10;

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:

INSTALL arrow FROM community;
LOAD arrow;

SELECT count(*)
FROM read_arrow('https://<sxs-host>/collect/sdmx/data/dataflow/OECD.DCD.FSD/DSD_PPFD@DF_PPFD/1.4?dimensionAtObservation=AllDimensions&limit=1000000&format=arrowstream');

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-loop or worker;
  • resource profile — normal or bulk.

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:

SettingDefaultEffect
WORKER_OBS_COUNT_LIMITunset (infinite)Above this size, use worker execution
BULK_OBS_COUNT_LIMITunset (infinite)Above this size, use the bulk resource profile
SYNC_MAX_OBSERVATIONS5000000Above this size, return 413 for synchronous requests

Settings can be set globally or per space:

WORKER_OBS_COUNT_LIMIT=10000
BULK_OBS_COUNT_LIMIT=50000
SYNC_MAX_OBSERVATIONS=5000000
{
  "workerObsCountLimit": 10000,
  "bulkObsCountLimit": 50000,
  "syncMaxObservations": 5000000
}

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 limit is 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

Normal profileBulk profile
ClickHouse tableDistributed table when the cluster is shardedLocal table on one node
ThreadsNormal cluster parallelismmax_threads = 1
Execution speedUnrestrictedCapped by max_execution_speed
Query cacheEligibleBypassed
ConcurrencyNormalThrottled by running bulk-resource jobs
Multi-dataset requestsAllowedMore than one bulk query is rejected

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:

Concurrent worker jobsmax_execution_speed
Fewer than 510M rows/s
Fewer than 101M rows/s
10 or more500K rows/s

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.

SettingDefaultDescription
WORKER_POOL_ENABLEDtrueEnable the worker path
WORKER_POOL_COUNTmin(4, availableParallelism - 1)Maximum workers per sxs instance
WORKER_POOL_QUEUE_SIZE20Maximum queued worker jobs
WORKER_POOL_MAX_PER_SPACE1Maximum concurrently running worker jobs per space
WORKER_POOL_MAX_JOBS20Jobs per worker before recycling it
WORKER_POOL_MEMORY_MB512Maximum old-generation heap per worker

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:

FormatDurationThroughputEvent-loop p99
JSON5.46 s183k obs/s2.29 ms
SDMX CSV7.71 s130k obs/s2.23 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 limit at or below both thresholds.
  • Bulk and normal profiles apply limit, offset and sort to all-dimensions queries. Native formats also support limit and offset and 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=csv uses the native path when allowNativeCsv is 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=1 query sampled every 25 ms during the bulk download
  • Event-loop delay measured with monitorEventLoopDelay
FormatObservationsDurationThroughputEvent-loop p99Fast query p50, idle → during bulk
JSON1,000,0015.18 s193k obs/s21.6 ms97.5 → 144.1 ms
SDMX-CSV1,000,00111.05 s90.5k obs/s14.8 ms96.4 → 348.5 ms
Native CSV1,000,0010.43 s2.32M obs/s2.8 ms96.7 → 100.2 ms
Parquet1,000,0010.27 s3.64M obs/s4.0 ms95.7 → 103.7 ms
JSON5,000,00125.51 s196k obs/s19.9 ms97.0 → 141.0 ms
SDMX-CSV5,000,00154.22 s92.2k obs/s14.6 ms95.1 → 346.7 ms
Native CSV5,000,0011.76 s2.84M obs/s3.2 ms96.0 → 101.9 ms
Parquet5,000,0011.11 s4.49M obs/s11.5 ms96.8 → 158.7 ms

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:

ItemValue
DataflowTEST:BENCH(1.0.0)
Data structureTEST:DS_BENCH(1.0.0)
Concept schemeTEST:CS_BENCH(1.0.0)
Test spacelimit, with bulkObsCountLimit = 2 to force the bulk resource profile
ComponentRoleFormatBenchmark value
DIM1DimensionString, no enumerationConstant A
DIM2DimensionString, no enumerationConstant B
MD_IDDimensionIntegerUnique per row (2, 3, …); inline observation ID
TIME_PERIODTime dimensionObservationalTimePeriodConstant 2020-01-01
M1MeasureDoubleCycles through 0.0–99.9

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.