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

# vector_search_* セッション設定

> vector_search_* 生成グループ内の ClickHouse セッション設定。

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["バージョン", "デフォルト値", "コメント"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        バージョン履歴
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

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](/ja/reference/system-tables/settings) で参照でき、[source](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) から自動生成されています。

<div id="vector_search_filter_strategy">
  ## vector\_search\_filter\_strategy
</div>

<SettingsInfoBlock type="VectorSearchFilterStrategy" default_value="auto" />

ベクトル検索クエリに WHERE 句がある場合、この設定は、先にそれを評価するか (事前フィルタリング) 、または先にベクトル類似度索引を参照するか (ポストフィルタリング) を決定します。設定可能な値:

* 'auto' - ポストフィルタリング (正確な動作は今後変更される可能性があります) 。
* 'postfilter' - ベクトル類似度索引を使用して最近傍を特定し、その後に他のフィルタを適用します
* 'prefilter' - 先に他のフィルタを評価し、その後で総当たり検索を実行して最近傍を特定します。

<div id="vector_search_index_fetch_multiplier">
  ## vector\_search\_index\_fetch\_multiplier
</div>

**別名**: `vector_search_postfilter_multiplier`

<SettingsInfoBlock type="Float" default_value="1" />

ベクトル類似度索引から取得する最近傍候補数にこの値を掛けます。ほかのフィルタ条件とのポストフィルタリングを行う場合、または設定 'vector\_search\_with\_rescoring = 1' の場合にのみ適用されます。有効範囲: \[1.0, 1000.0]。この範囲外の値は受け付けられません。

<div id="vector_search_use_quantized_codes">
  ## vector\_search\_use\_quantized\_codes
</div>

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

`Quantized` で圧縮されたカラムに対して、索引を使わない 2 段階の近似ベクトル検索 (総当たりスキャン) を有効にします。有効にすると、`Quantized(...)` コーデックでエンコードされたカラムに対する `ORDER BY L2Distance|cosineDistance(vec, reference) LIMIT k` は、次のように動作します。

1. 量子化されたベクトルをスキャンして絞り込みます (この段階では `k * vector_search_index_fetch_multiplier` 件の結果が生成されます) 。
2. 見つかったベクトルを、元のフル精度ベクトルに対して再スコアリングします。

<div id="vector_search_with_rescoring">
  ## vector\_search\_with\_rescoring
</div>

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

ClickHouse が、ベクトル類似度索引を使用するクエリでリスコアリングを実行するかどうかを指定します。
リスコアリングを行わない場合、ベクトル類似度索引は最良の一致を含む行を直接返します。
リスコアリングを行う場合、ベクトル類似度索引は候補行を取得し、ClickHouse は通常の SQL パイプライン内で
それらの行に対し、元のフル精度ベクトルから正確な距離を計算します。
可能な場合、ClickHouse は最終的な距離計算の前に、スキャン対象を候補行に絞り込みます。
より高い再現率のためにさらに多くの候補行が必要な場合は、特に
追加のフィルターや量子化されたベクトル索引を使用しているときに、`vector_search_index_fetch_multiplier` を増やしてください。
注: リスコアリングを行わずに実行され、かつ並列レプリカが有効なクエリは、リスコアリングにフォールバックする場合があります。
