# Setup segments

If your datasets contain a signal that represents segment information, you can visualize those segments directly in Insight.&#x20;

{% hint style="warning" %}
Segment support is still under development, so the configuration requires a small amount of technical setup. More options and improved usability will be added over time.
{% endhint %}

Follow the guidelines below to enable segment visualization today.

#### 1. Configure the "List segments" Query

1. Go to **Settings → Connection**.
2. In the **Queries** tab, verify that the **List segments** query is available.
   * If the query is missing, download and import the latest `connection.json` from **Marple DB** to update your queries.\
     ![](/files/AdZNyNXgsXtlvuK1TnmO)
3. Paste the following query into the **List segments** query field:

```
select
  value as id,
  value as label,
  min(time) as start,
  max(time) as stop
from mdb_default_data({{ dataset.dataset }}, {{ segment_id | int }})
group by value, label
```

#### 2. Define the `segment_id` variable

To tell Insight which signal represents your segments, create a constant variable:

1. At the top of the **Queries** tab, add a new variable named **segment\_id**.
2. The value of this constant must be the **internal ID** of the segment signal in Marple DB.

<figure><img src="/files/GOcKvVJFt9Pt0Jxz6ovV" alt=""><figcaption></figcaption></figure>

To find this ID:

1. Open a dataset in **Marple DB** that contains the segment signal.
2. Go to the **Signals** tab.
3. Locate the signal you want to use as the segment signal.
4. Copy the value from the **ID** column.
5. Paste this value as the constant’s value for `segment_id`.\
   ![](/files/5hhZFKJuCnzb5yTMU1Su)

#### 3. Configure Segment Metadata (Optional)

In the **Metadata** section at the bottom of the Queries tab, you can fine-tune how segments appear in the Insight interface.

Available options:

* **Segment alias**\
  Choose how segments are labeled in Insight (e.g., “Lap”).
* **Highlight fastest segment**\
  When enabled, Insight highlights the fastest segment in purple in the segment overview.

<figure><img src="/files/pI2AvCSkFPwBFdJmDgph" alt=""><figcaption></figcaption></figure>


---

# 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.marpledata.com/docs/marple-insight/setup-and-configuration/data-connection/supported-databases/marple-db/setup-segments.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.
