Skip to content

Conversation

@RaphDal
Copy link

@RaphDal RaphDal commented Oct 22, 2025

This PR adds decimal support.

This is a tandem pr for:

Usage

Textual representation

import { Sender } from "@questdb/nodejs-client";

async function runDecimals() {
  const sender = await Sender.fromConfig(
    "tcp::addr=127.0.0.1:9009;protocol_version=3",
  );

  await sender
    .table("fx")
    // textual ILP form keeps the literal and its exact scale
    .decimalColumnText("mid", "1.234500")
    .atNow();

  await sender.flush();
  await sender.close();
}

runDecimals().catch(console.error);
// Resulting ILP line: fx mid=1.234500d

Binary representation

It is recommended to use the binary representation for better ingestion performance and reduced payload size (for bigger decimals).

import { Sender } from "@questdb/nodejs-client";

async function runDecimals() {
  const sender = await Sender.fromConfig(
    "tcp::addr=127.0.0.1:9009;protocol_version=3",
  );

  await sender
    .table("fx")
    // textual ILP form keeps the literal and its exact scale
    .decimalColumnUnscaled("mid", 123456n, 3) // 123456 * 10^-3 = 123.456
    .atNow();

  await sender.flush();
  await sender.close();
}

runDecimals().catch(console.error);

Progress

  • support binary and text formats
  • release decimal on QuestDB OSS

@RaphDal
Copy link
Author

RaphDal commented Oct 24, 2025

@CodeRabbit review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants