# Database

<figure><img src="/files/1VnxngD4cGhOCGdx50E8" alt=""><figcaption></figcaption></figure>

All data imported into **Gaio DataOS** is stored internally in a high-performance local database.\
Behind the scenes, Gaio uses the **ClickHouse** database engine to store, manage, and query data across your flows, dashboards, and APIs.

### What is ClickHouse?

[ClickHouse](https://clickhouse.com/) is a **column-oriented database management system (DBMS)** designed for **real-time analytical processing (OLAP)**. It was built to deliver **lightning-fast queries** on **massive volumes of data**, making it ideal for modern data platforms like Gaio.

***

### Benefits of ClickHouse in Gaio

| Feature                       | Description                                                                                                       |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **Blazing-fast performance**  | ClickHouse is optimized for analytical queries and can process billions of rows per second on commodity hardware. |
| **Columnar storage**          | Stores data by columns instead of rows, reducing disk I/O and improving query speed dramatically.                 |
| **Real-time analytics**       | Supports real-time data ingestion and instant query execution — perfect for dashboards and live monitoring.       |
| **Efficient compression**     | Automatically compresses data, reducing storage footprint while preserving performance.                           |
| **Scalability**               | Easily scales horizontally with distributed architecture — useful for enterprise-scale workloads.                 |
| **SQL-compatible**            | Uses familiar SQL syntax, making it accessible for analysts, engineers, and data scientists.                      |
| **Fault-tolerant & reliable** | Includes support for replication, backup, and high availability across nodes.                                     |

***

#### How It Works in Gaio

* When data is uploaded or ingested into a **Data Project**, it is stored in your project’s isolated **ClickHouse schema**.
* All **flows**, **dashboards**, and **AI features** run queries directly on top of ClickHouse, ensuring high performance without additional infrastructure.
* Every action, from filtering a table to exploring data distributions (as shown in the image above), is powered by ClickHouse’s real-time query engine.

### Performance Benchmarks: ClickHouse vs Other Databases

ClickHouse consistently outperforms traditional and cloud-native databases in OLAP scenarios. Below is a comparison of query performance based on public benchmarks and real-world use cases.

> **Note:** Benchmarks may vary depending on infrastructure, dataset size, and query complexity. The table below reflects averages from public sources like ClickBench, Altinity, and independent performance tests.

| Database       | Type             | Query Latency (on 1B rows)  | Data Compression Ratio | OLAP Optimization | Real-Time Capabilities |
| -------------- | ---------------- | --------------------------- | ---------------------- | ----------------- | ---------------------- |
| **ClickHouse** | Columnar, OLAP   | **<1 second**               | **3–8x**               | ✅ **Yes**         | ✅ **Yes**              |
| PostgreSQL     | Row-based, OLTP  | \~30–60 seconds             | 1–2x                   | ❌ No              | ❌ Limited              |
| BigQuery       | Serverless OLAP  | \~3–10 seconds (cold start) | 2–4x                   | ✅ Yes             | ❌ No (batch-based)     |
| Redshift       | Columnar, OLAP   | \~5–15 seconds              | 2–4x                   | ✅ Yes             | ❌ No (cached)          |
| Snowflake      | Cloud-based OLAP | \~5–20 seconds              | 3–6x                   | ✅ Yes             | ❌ No (batch)           |
| MySQL          | Row-based, OLTP  | \~50–120 seconds            | \~1x                   | ❌ No              | ❌ No                   |

#### Why Gaio Chose ClickHouse

Gaio DataOS was designed for **speed, flexibility, and scalability**. ClickHouse was the natural choice for the following reasons:

* It's **open-source**, robust, and proven in production at scale (used by Yandex, Cloudflare, and others).
* It allows Gaio to deliver **low-latency queries** across huge datasets with **minimal resource overhead**.
* Its **native SQL support**, **built-in compression**, and **distributed architecture** perfectly match Gaio's mission: **democratizing enterprise analytics without compromising on performance**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gaiodataos.com/fundamentals/database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
