apla / node-clickhouse

Yandex ClickHouse driver for nodejs
MIT License
216 stars 50 forks source link

Multistatement query is not executing #28

Closed AKGP closed 5 years ago

AKGP commented 5 years ago

I had an issue with running the multi statement query. Please provide a solution for this.

southwolf commented 5 years ago

Search Google. Clickhouse HTTP mode does not support multi statement.

https://groups.google.com/forum/#!topic/clickhouse/Bd-WWGhahO8 https://github.com/yandex/clickhouse-jdbc/issues/51

nezed commented 5 years ago

Thats right, since node-clickhouse uses HTTP interface, multi statement queries aren't supported. Pay attention! Clickhouse is OLAP oriented DBMS and designed for queries with large data aggregation.

In case if you're still need to run few queries at the time, you may try following:

SELECT
  (SELECT 1) AS a,
  (SELECT 2) AS b

or

const [a, b] = await Promise.all([
  ch.querying('SELECT 1'),
  ch.querying('SELECT 2'),
])

.querying isn't recommended for large datasets!