Query data

This page shows how to query data from QuestDB using different programming languages or tools.

First things first#

Make sure you have QuestDB running and accessible, you can do so from Docker, the binaries or Homebrew for macOS users.

REST API#

You can query data using the REST API, this will work with a very wide range of libraries and tools. The REST API is accessible on port 9000.

curl -G \
--data-urlencode "query=SELECT x FROM long_sequence(5);" \
http://localhost:9000/exec

Postgres compatibility#

You can query data using the Postgres endpoint that QuestDB exposes. This is accessible via port 8812.

const { Client } = require("pg")
const start = async () => {
try {
const client = new Client({
database: "qdb",
host: "127.0.0.1",
password: "quest",
port: 8812,
user: "admin",
})
await client.connect()
const res = await client.query("SELECT x FROM long_sequence(5);")
console.log(res.rows)
await client.end()
} catch (e) {
console.log(e)
}
}
start()