> 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-insight/setup-and-configuration/data-connection/supported-databases/marple-db/setup-segments.md).

# Setup segments

How to set up segments for a Marple DB connection

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.\
     ![](https://3590686807-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwEBNWlmdcxXBXd7oyqyR%2Fuploads%2FWQ7aYAfso0g3gLhJQRlo%2Fimage.png?alt=media\&token=2db8af43-e303-4dab-9912-c4cd4f237201)
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="https://3590686807-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwEBNWlmdcxXBXd7oyqyR%2Fuploads%2FR8GVByze1k7LBFPWLNmg%2Fimage.png?alt=media&amp;token=82616d3d-1356-4eeb-aa8b-9f6a0d7ea055" 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`.\
   ![](https://3590686807-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwEBNWlmdcxXBXd7oyqyR%2Fuploads%2FD3jKPLqtWl3wrBctSlrG%2Fimage.png?alt=media\&token=aacd8900-c41a-4cf5-ae08-3d46942330a9)

#### 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="https://3590686807-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwEBNWlmdcxXBXd7oyqyR%2Fuploads%2FL6hoqiCF1jkvDKtisj5b%2Fimage.png?alt=media&amp;token=36f31519-1b8d-48e6-af9e-da8d457b781b" alt=""><figcaption></figcaption></figure>

#### Discover Segments in 1 minute

{% embed url="<https://www.youtube.com/watch?v=uyE5QmMUEME>" %}

Want to discover more features? Check out other [1 Minute Marple videos](/docs/other-resources/1-minute-marple-videos.md).
