Update data
This page shows how to update existing data in QuestDB using different programming languages and tools. There are two main methods for updating data:
- Postgres wire protocol for compatibility with a range of clients
- REST API provides access to QuestDB via HTTP
Prerequisites#
This page assumes that QuestDB is running and accessible. QuestDB can be run using either Docker, the Binaries or Homebrew for macOS users.
Postgres compatibility#
You can query data using the Postgres endpoint
that QuestDB exposes. This is accessible via port 8812 by default. More
information on the Postgres wire protocol implementation with details on
supported features can be found on the
Postgres API reference page.
- NodeJS
- Java
- Python
This example uses the pg package which
allows for quickly building queries using Postgres wire protocol. Details on the
use of this package can be found on the
node-postgres documentation.
This example uses naive Date.now() * 1000 inserts for Timestamp types in
microsecond resolution. For accurate microsecond timestamps, the
process.hrtime.bigint() call can be used.
REST API#
QuestDB exposes a REST API for compatibility with a wide range of libraries and
tools. The REST API is accessible on port 9000 and has the following
entrypoints:
/imp- import data/exec- execute an SQL statement
More details on the use of these entrypoints can be found on the REST API reference page.
/imp endpoint#
The /imp endpoint does not allow for updating data.
/exec endpoint#
Alternatively, the /exec endpoint can be used to create a table and the
INSERT statement can be used to populate it with values:
- cURL
- NodeJS
- Python
The node-fetch package can be installed using npm i node-fetch.
Web Console#
By default, QuestDB has an embedded Web Console running at http://[server-address]:9000. When running locally, this is accessible at http://localhost:9000. The Web Console can be used to explore table schemas, visualizing query results as tables or graphs, and importing datasets from CSV files. For details on these components, refer to the Web Console reference page.