> For the complete documentation index, see [llms.txt](https://docs.marpledata.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.marpledata.com/docs/marple-db/querying-old-deprecated.md).

# Querying \[old, deprecated]

{% hint style="success" %}
Querying Marple DB outside from Marple Insight is available to the following plans:

* Marple DB VPC
* Marple DB self-managed
  {% endhint %}

## Why query Marple DB?

Querying Marple DB directly allows you to execute advanced use cases:

* Train machine learning models
* Calculate complex aggregates
* Generate standardised reports
* ... and much more

By running these types of analysis on Marple DB, they can be 10-100x faster than traditional scripting. In those cases, the extract-load-transform (ELT) often makes it unfeasible both in terms of run time and computational demand.

By querying Marple DB, you get more value from data that is already collected, cleaned, standarised and optimised for time series operations.

## Hot storage (Postgres)

<i class="fa-key">:key:</i>  Request your database credentials from our [support team](mailto:support@marpledata.com).

### Structure

The hot storage is organised into three schemas:

1. `_mdb` contains internal bookkeeping. Touching this might cause malfunction
2. `mdb_data` has the actual time series data of heated signals. Should also not be used directly for most use cases
3. `public` contains three tables per datapool (called `default` in most cases)
   * `_dataset` with file and metadata info
   * `_signal` with signal info and metadata
   * `_signal_enum` guarantees uniqueness of signal names

<figure><img src="https://3590686807-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwEBNWlmdcxXBXd7oyqyR%2Fuploads%2F6itPnyfn1KIewbXlx3CK%2Fdb-schema.png?alt=media&amp;token=6658e30e-8191-4b5b-a01e-82852300750f" alt="" width="299"><figcaption></figcaption></figure>

### Querying

You can use any Postgres-compatible tool for sending queries.

For reading time series data, a premade function makes it a lot easier to get data:

<pre class="language-sql"><code class="lang-sql">-- getting data from datapool 'default'
<strong>SELECT * 
</strong><strong>FROM mdb_default_data(
</strong>    'file.csv', -- or alternatively, use dataset_id
    'speed', -- or alternatively, usesignal_id 
    0, # start timestamp (nanoseconds)
    279112 # end timestamp (nanoseconds)
)
</code></pre>

## Cold storage (Parquet)

<i class="fa-key">:key:</i> Request your blob storage credentials from our [support team](mailto:support@marpledata.com).

### Structure

The cold storage follows a directory structure with `Datapool` > `Dataset` > `Signal` > `Parquet file` :

<figure><img src="https://3590686807-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwEBNWlmdcxXBXd7oyqyR%2Fuploads%2Fvreh62SaJYJJu9ivp7rS%2Fcold-structure(1).png?alt=media&amp;token=6494ea26-ba2f-424a-a275-f60b6b5eb229" alt="" width="375"><figcaption></figcaption></figure>

This contains the dataset name and signal names, but no other metadata.&#x20;

The actual data is stored in [parquet files](https://en.wikipedia.org/wiki/Apache_Parquet) that contain the raw time series data for one signal. If a signal contains a lot of data, it might be split across multiple parquet files (`mdb_0.parquet`, `mdb_1.parquet`, ...) that each contain a different time slice.

### Querying

Querying can be done by downloading individual Parquet files, or by writing queries in [Duck DB](https://duckdb.org/) (or similar tools).
