> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Reads time series from a TimeSeries table filtered by a selector and with timestamps in a specified interval.

# timeSeriesSelector

Reads time series from a TimeSeries table filtered by a selector and with timestamps in a specified interval.
This function is similar to [range selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/#range-vector-selectors) but it's used to implement [instant selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/#instant-vector-selectors) too.

<h2 id="syntax">
  Syntax
</h2>

```sql theme={null}
timeSeriesSelector('db_name', 'time_series_table', 'instant_query', min_time, max_time)
timeSeriesSelector(db_name.time_series_table, 'instant_query', min_time, max_time)
timeSeriesSelector('time_series_table', 'instant_query', min_time, max_time)
```

<h2 id="arguments">
  Arguments
</h2>

* `db_name` - The name of the database where a TimeSeries table is located.
* `time_series_table` - The name of a TimeSeries table.
* `instant_query` - An instant selector written in [PromQL syntax](https://prometheus.io/docs/prometheus/latest/querying/basics/#instant-vector-selectors), without `@` or `offset` modifiers.
* \`min\_time - Start timestamp, inclusive.
* \`max\_time - End timestamp, inclusive.

<h2 id="returned_value">
  Returned value
</h2>

The function returns three columns:

* `id` - Contains the identifiers of time series matching the specified selector.
* `timestamp` - Contains timestamps.
* `value` - Contains values.

There is no specific order for returned data.

<h2 id="example">
  Example
</h2>

```sql theme={null}
SELECT * FROM timeSeriesSelector(mytable, 'http_requests{job="prometheus"}', now() - INTERVAL 10 MINUTES, now())
```
