> ## 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.

# replace_running_query_* セッション設定

> replace_running_query_* の自動生成グループに含まれる ClickHouse のセッション設定。

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>型</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>デフォルト値</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          再起動せずに変更可能
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

これらの設定は [system.settings](/docs/ja/reference/system-tables/settings) で確認でき、[source](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) から自動生成されています。

<div id="replace_running_query">
  ## replace\_running\_query
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

HTTPインターフェイスを使用する場合は、`query_id` パラメータを渡せます。これはクエリ識別子として機能する任意の文字列です。
この時点ですでに同じユーザーによる同じ `query_id` のクエリが存在する場合の動作は、`replace_running_query` パラメータによって決まります。

`0` (デフォルト) – 例外をスローする (同じ `query_id` のクエリがすでに実行中の場合、そのクエリの実行は許可されません) 。

`1` – 古いクエリをキャンセルし、新しいクエリの実行を開始します。

セグメンテーション条件の候補を実装する場合は、このパラメータを 1 に設定してください。次の文字を入力した時点で、古いクエリがまだ終了していなければキャンセルされます。

<div id="replace_running_query_max_wait_ms">
  ## replace\_running\_query\_max\_wait\_ms
</div>

<SettingsInfoBlock type="Milliseconds" default_value="5000" />

[replace\_running\_query](/docs/ja/reference/settings/session-settings/replace-running-query#replace_running_query) 設定が有効な場合に、同じ `query_id` を持つ実行中のクエリが完了するまで待機する時間です。

設定可能な値:

* 正の整数。
* 0 — サーバーがすでに同じ `query_id` を持つクエリを実行している場合、例外を発生させ、新しいクエリは実行できません。
