> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/setup-and-monitor/operate-and-monitor/query-your-datamart/query-tool.md).

# Query Tool

Explore your data interactively in Data Studio, and turn a query into a segment, an export, or a chart.

## Your goal

Write a query, see the answer, and act on it - save it as a chart, turn it into a segment, or make it an export - without writing any code.

## Expected outcome

Answers you trust, and reusable charts your team can load.

## Who uses it, and for what

The Query Tool queries data with [OTQL](/setup-and-monitor/operate-and-monitor/query-your-datamart/otql.md).

| Usage                      | Who                      |
| -------------------------- | ------------------------ |
| **Build segments**         | Marketers                |
| **Do acceptance tests**    | Marketers, data analysts |
| **Monitor data ingestion** | Marketers, data analysts |
| **Explore data**           | Marketers, data analysts |
| **Build exports**          | Data analysts            |

## The interface

Opening the Query Tool, you get:

* A **query builder** to write OTQL queries.
* **Action buttons** to save and share charts, save segments, create exports.
* **Query settings** controlling how queries are run.
* **Your data model**, so you can see which fields exist. See [Schema definition](/setup-and-monitor/collect-and-manage-your-data/design-your-data-model-and-schema/schema-definition.md).
* **Saved charts**, a list of frequent queries and their visualisations, for you and your team.

## What a result looks like

What you get back depends on what you asked for.

{% tabs %}
{% tab title="Volumes" %}
A single number: a volume of users, of events, an average transaction amount.

You can save the metric or create an export from it.
{% endtab %}

{% tab title="Series" %}
A distribution of values, produced by an aggregation such as `@map`, or by combining several metrics with **New Value**.

Series can be saved or exported, and displayed as a table, bar or column chart, radar, pie, or line and area chart.
{% endtab %}

{% tab title="Date histograms" %}
A series whose key column holds dates. Same options as a regular series, plus control over how dates are formatted.

Area charts usually render these best.
{% endtab %}

{% tab title="Multiple series" %}
Several requests in the same tab, added with **New Series**.

Multiple queries **can be saved but cannot be exported**.
{% endtab %}

{% tab title="Objects and identifiers" %}
A query returning metadata shows a **sample of ten UserPoints** as JSON.

To get a complete extract, create an export.

{% hint style="info" %}
If the query returns only user identifiers - starting with `SELECT {id} FROM UserPoint WHERE ...` - you can create a **segment** from it directly.
{% endhint %}
{% endtab %}
{% endtabs %}

## Query settings

Three options change how a query runs, and two of them change the answer.

| Setting                                     | What it does                                                                                                                             |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **Evaluate the `SELECT` clause in GraphQL** | Uses GraphQL for the selection. See [GraphQL queries](/setup-and-monitor/operate-and-monitor/query-your-datamart/graphql-queries.md).    |
| **Use the cache**                           | Returns a faster result if someone ran the request recently. **Your query does not go into the cache if you do not select this option.** |
| **Precision** - Full, Medium, or Low        | Lower precisions execute faster.                                                                                                         |

{% hint style="danger" %}
**Use full precision when building segments** with the Query Tool, so the volumes you see are the exact volumes you can expect in the segment.

A medium- or low-precision count is an approximation. It is fine for exploring, and misleading as a basis for a commitment to a partner.
{% endhint %}

## Turning a query into something

| Action                         | What it does                                                   | Condition                                                             |
| ------------------------------ | -------------------------------------------------------------- | --------------------------------------------------------------------- |
| **Clear tabs**                 | Returns to a clean state with a single tab.                    |                                                                       |
| **Save this chart**            | Saves the query and its display, for later or for a dashboard. | Not available for queries returning JSON.                             |
| **Save As User Query Segment** | Creates a segment from the current query.                      | The query must be of the form `SELECT {id} FROM UserPoint WHERE ...`. |
| **Save As Export**             | Creates an export from the current query.                      |                                                                       |
| **Save As Technical query**    | Creates a technical query, for use by developers.              | Only one query.                                                       |

## Charts

Saved charts can be loaded by anyone with access to your organisation. On a loaded chart you can:

* **Share** - creates a link that opens the chart in the Query Tool. It is a shortcut only: **access is still governed by permissions** on your organisation.
* **Update** - save changes to the query or its display, and rename the chart.
* **Delete** - note that **if the chart is used in a dashboard, it disappears from the dashboard**.

{% hint style="success" %}
Charts are how OTQL knowledge spreads: someone comfortable with the language saves the queries their team needs, and everyone else loads them.
{% endhint %}

## Verify

* A count you can check independently - total UserPoints, for instance - matches.
* Segment-bound queries were run at **full precision**.
* A chart used in a dashboard is not deleted by accident.

## Related pages

<table data-view="cards" data-search="false"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>OTQL</strong></td><td>The language you write here.</td><td><a href="/setup-and-monitor/operate-and-monitor/query-your-datamart/otql.md">OTQL</a></td></tr><tr><td><strong>Create a custom dashboard</strong></td><td>Where saved charts end up.</td><td><a href="/setup-and-monitor/operate-and-monitor/create-a-custom-dashboard.md">Create a custom dashboard</a></td></tr><tr><td><strong>Export</strong></td><td>Turning a query into a file.</td><td><a href="/setup-and-monitor/collect-and-manage-your-data/export-your-data/export.md">Export</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mediarithmics.io/setup-and-monitor/operate-and-monitor/query-your-datamart/query-tool.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
