> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# timeSeriesSelector

> セレクタで絞り込み、指定した interval 内のタイムスタンプを持つ TimeSeries テーブルから時系列を読み取ります。

セレクタで絞り込み、指定した interval 内のタイムスタンプを持つ TimeSeries テーブルから時系列を読み取ります。
この関数は [range selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/#range-vector-selectors) に似ていますが、[インスタントセレクタ](https://prometheus.io/docs/prometheus/latest/querying/basics/#instant-vector-selectors) の実装にも使用されます。

## 構文

```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)
```

## 引数

* `db_name` - TimeSeriesテーブルが存在するデータベースの名前。
* `time_series_table` - TimeSeriesテーブルの名前。
* `instant_query` - `@` または `offset` 修飾子を含まない、[PromQL構文](https://prometheus.io/docs/prometheus/latest/querying/basics/#instant-vector-selectors)で記述されたインスタントセレクタ。
* `min_time` - 開始タイムスタンプ (この値を含む) 。
* `max_time` - 終了タイムスタンプ (この値を含む) 。

テーブル内のタイムスタンプが整数秒であっても、`min_time` と `max_time` には秒未満の値を指定できます。
この関数は、境界値をタイムスタンプの型に丸めることなく、`min_time <= timestamp <= max_time` を厳密に満たすサンプルを選択します。

## 戻り値

この関数は 3 つのカラムを返します。

* `id` - 指定したセレクタに一致する時系列の識別子を含みます。
* `timestamp` - タイムスタンプを含みます。
* `value` - 値を含みます。

返されるデータの順序は定められていません。

## 例

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