Search code examples
questdb

QuestDB Line Protocol


I'm using the NodeJS demo code from here: https://questdb.io/docs/develop/insert-data/ to insert data into QuestDB like this:

   setInterval(() => {
        run();
    }, 3000);

(2 Docker containers on a bridge network)

And I have a browser window open to run

select count(*) from 'trades'

However, the query only runs once and then returns the same result. If I restart the docker containers, the query returns an updated value so I assume the values are successfully getting into the database but they are not reflected in the Postgres queries. I see the same behavior when I use the pg client in Node.

Any explanation or theory that would help me root cause this?


Solution

  • In QDB data is not visible to queries until it's committed . In case of ILP receiver commits don't happen after each row or even on disconnect . Instead QDB uses a number of properties to determine when to commit efficiently . In this case the easiest way to reduce insert to commit delay would be to reduce cairo.max.uncommitted.rows to e.g. 10 in conf/server.conf (plus instance/container restart) and then insert 10+ records .

    You'll find more details on ILP commits at https://questdb.io/docs/reference/api/ilp/tcp-receiver/#commit-strategy