Data Query Overview
The data lake has multiple storage systems, and the query language depends on what you are asking about. This section summarizes how to use each of the three.
| What you want to ask about | Storage | Language | Documentation |
|---|---|---|---|
| Metadata such as equipment, tags, or users | PostgreSQL | SQL | PostgreSQL |
| Time series such as tag values | Aster TSDB | CQL | CQL |
| Join and bulk analysis across multiple storage systems | Spark (Kyuubi) | Spark SQL | Spark SQL |
If it's one tag over one period, use CQL. For equipment lists or configurations, use PostgreSQL. If you need to mix multiple storage systems or scan hundreds of millions of rows, use Spark SQL.
The three are different in nature
| PostgreSQL | Aster TSDB (CQL) | Spark SQL | |
|---|---|---|---|
| Good at | Joins, constraints, transactions | Time-range queries within a single partition | Bulk scans, cross-storage joins |
| Not good at | Time series with hundreds of millions of rows | Arbitrary joins, queries without a partition key | Short responses (startup cost in seconds) |
| Response time | Milliseconds | Milliseconds | Seconds to minutes |
| Where it attaches | 5432 | 9042 | 10000 (Kyuubi) |
🔴 Do not use CQL as if it were SQL. Aster TSDB is a storage system that works by "finding via partition key and scanning in clustering order."
If you apply conditions without a partition key, it will search all nodes, and in that case Aster TSDB
requires ALLOW FILTERING — and that requirement is a warning, not permission.
Send such queries to Spark SQL.
How to connect — two approaches
① From the console — Execute SQL in a browser. Accounts, permissions, and auditing are enforced.
The Data Gateway Console is that interface. It is the normal path for a person to connect to a node that is in production.
② Inside the node — Connect directly via shell. This is for operations and debugging.
docker exec -it plantpulse-datalake pd node psql # PostgreSQL
docker exec -it plantpulse-datalake pd node cql # Cassandra (cqlsh)
Connecting directly bypasses the gateway's permissions and auditing. Use the console for queries, and use the shell only for tasks that cannot be done from the console.
See also
- Time Series Database — CQL time series functions, compression, and full-text search
- Data Gateway Console — Browser-based SQL execution
- Client Libraries — How to connect from your programs