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

# force_* セッション設定

> force_* グループに含まれる ClickHouse のセッション設定。

export const CloudOnlyBadge = () => {
  return <div className="cloudBadge">
            <div className="cloudIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path fillRule="evenodd" clipRule="evenodd" d="M5.33395 12.6667H12.3739C13.6593 12.6667 14.7073 11.6187 14.7073 10.3334C14.7073 9.04804 13.6593 8.00004 12.3739 8.00004H12.0839V7.33337C12.0839 5.12671 10.2906 3.33337 8.08395 3.33337C6.09928 3.33337 4.45395 4.78537 4.14195 6.68204C2.55728 6.76271 1.29395 8.06204 1.29395 9.66671C1.29395 11.3234 2.63728 12.6667 4.29395 12.6667H5.33395Z" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
            </svg>
        </div>
            {'ClickHouse Cloud 専用'}
        </div>;
};

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) で利用でき、[ソースコード](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) から自動生成されています。

<div id="force_aggregate_partitions_independently">
  ## force\_aggregate\_partitions\_independently
</div>

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

この最適化を適用可能でありながら、ヒューリスティックによって使用しないと判断された場合でも、使用を強制します

<div id="force_aggregation_in_order">
  ## force\_aggregation\_in\_order
</div>

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

この設定は、分散クエリをサポートするためにサーバー自体で使用されます。通常の動作に支障をきたすため、手動で変更しないでください。 (分散集約時に、リモートノードで順序付き集約を使用するよう強制します) 。

<div id="force_creating_set_partitions_independently">
  ## force\_creating\_set\_partitions\_independently
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.8"},{"label": "0"},{"label": "パーティションの偏りチェックによってスキップされる場合でも、`IN (subquery)` のセット構築時にパーティションごとの事前重複排除を強制する新しい設定。"}]}]} />

適用可能であるにもかかわらず、パーティションの偏りチェック (最大のパーティションが平均の2倍を超える場合) により使用しないと判断された場合でも、`IN (subquery)` のセット構築時にパーティションごとの事前重複排除を強制します。[allow\_creating\_set\_partitions\_independently](/ja/reference/settings/session-settings/allow#allow_creating_set_partitions_independently) の偏りチェックのみをバイパスし、その他の条件は引き続き適用されます。

<div id="force_data_skipping_indices">
  ## force\_data\_skipping\_indices
</div>

指定したデータスキッピングインデックスが使用されなかった場合、クエリ実行を無効化します。

次の例を見てみましょう。

```sql theme={null}
CREATE TABLE data
(
    key Int,
    d1 Int,
    d1_null Nullable(Int),
    INDEX d1_idx d1 TYPE minmax GRANULARITY 1,
    INDEX d1_null_idx assumeNotNull(d1_null) TYPE minmax GRANULARITY 1
)
Engine=MergeTree()
ORDER BY key;

SELECT * FROM data_01515;
SELECT * FROM data_01515 SETTINGS force_data_skipping_indices=''; -- query will produce CANNOT_PARSE_TEXT error.
SELECT * FROM data_01515 SETTINGS force_data_skipping_indices='d1_idx'; -- query will produce INDEX_NOT_USED error.
SELECT * FROM data_01515 WHERE d1 = 0 SETTINGS force_data_skipping_indices='d1_idx'; -- Ok.
SELECT * FROM data_01515 WHERE d1 = 0 SETTINGS force_data_skipping_indices='`d1_idx`'; -- Ok (example of full featured parser).
SELECT * FROM data_01515 WHERE d1 = 0 SETTINGS force_data_skipping_indices='`d1_idx`, d1_null_idx'; -- query will produce INDEX_NOT_USED error, since d1_null_idx is not used.
SELECT * FROM data_01515 WHERE d1 = 0 AND assumeNotNull(d1_null) = 0 SETTINGS force_data_skipping_indices='`d1_idx`, d1_null_idx'; -- Ok.
```

<div id="force_distinct_partitions_independently">
  ## force\_distinct\_partitions\_independently
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.8"},{"label": "0"},{"label": "コストヒューリスティックによってスキップされる場合でも、パーティションごとに独立して `DISTINCT` を評価するよう強制する新しい設定。"}]}]} />

適用可能であるにもかかわらずコストヒューリスティックが使用しないと判断した場合でも、パーティションごとに独立して `DISTINCT` を評価するよう強制します。[allow\_distinct\_partitions\_independently](/ja/reference/settings/session-settings/allow#allow_distinct_partitions_independently) のコストヒューリスティックのみをバイパスし、それ以外の条件は引き続き適用されます。

<div id="force_grouping_standard_compatibility">
  ## force\_grouping\_standard\_compatibility
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.9"},{"label": "1"},{"label": "GROUPING関数の出力をSQL標準および他のDBMSと同じにします"}]}]} />

引数が集約キーとして使用されていない場合、GROUPING関数は1を返します

<div id="force_index_by_date">
  ## force\_index\_by\_date
</div>

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

日付条件で索引を利用できない場合、クエリ実行を無効にします。

MergeTree family に属するテーブルで動作します。

`force_index_by_date=1` の場合、ClickHouse は、データ範囲の絞り込みに使用できる日付キー条件がクエリに含まれているかどうかを確認します。適切な条件がない場合は、例外をスローします。ただし、その条件によって読み取るデータ量が実際に減るかどうかまでは確認しません。たとえば、条件 `Date != ' 2000-01-01 '` は、テーブル内のすべてのデータに一致する場合でも許容されます (つまり、クエリの実行にはフルスキャンが必要です) 。MergeTree テーブルにおけるデータ範囲の詳細については、[MergeTree](/ja/reference/engines/table-engines/mergetree-family/mergetree) を参照してください。

<div id="force_primary_key">
  ## force\_primary\_key
</div>

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

主キー索引を使用できない場合、クエリ実行を無効にします。

MergeTree family のテーブルで動作します。

`force_primary_key=1` の場合、ClickHouse はクエリに、データの範囲を絞り込むために使用できる主キー条件があるかどうかを確認します。適切な条件がない場合は、例外をスローします。ただし、その条件によって読み取るデータ量が減るかどうかまでは確認しません。MergeTree テーブルにおけるデータ範囲の詳細については、[MergeTree](/ja/reference/engines/table-engines/mergetree-family/mergetree) を参照してください。

<div id="force_read_through_distributed_cache">
  ## force\_read\_through\_distributed\_cache
</div>

<CloudOnlyBadge />

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.9"},{"label": "auto"},{"label": "単一のクエリに対してサーバー設定 `enable_read_through_distributed_cache` を上書きする新しい設定。"}]}, {"id": "row-2","items": [{"label": "26.8"},{"label": "auto"},{"label": "単一のクエリに対してサーバー設定 `enable_read_through_distributed_cache` を上書きする新しい設定。"}]}]} />

ClickHouse Cloud でのみ有効です。単一のクエリに対してサーバー設定 `enable_read_through_distributed_cache` を上書きします。デフォルトの `auto` は、サーバー設定に従います。

<div id="force_remove_data_recursively_on_drop">
  ## force\_remove\_data\_recursively\_on\_drop
</div>

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

DROP クエリ時にデータを再帰的に削除します。これにより 'Directory not empty' エラーは回避されますが、デタッチされたデータも気付かないうちに削除される可能性があります

<div id="force_window_partitions_independently">
  ## force\_window\_partitions\_independently
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.8"},{"label": "0"},{"label": "コストヒューリスティックによってスキップされる場合でも、パーティションごとにウィンドウ関数を独立して評価するよう強制する新しい設定。"}]}]} />

適用可能であってもコストヒューリスティックによって使用しないと判断された場合に、パーティションごとのウィンドウ関数の独立した評価を強制します。[allow\_window\_partitions\_independently](/ja/reference/settings/session-settings/allow#allow_window_partitions_independently) のコストヒューリスティックのみをバイパスし、他の条件は引き続き適用されます。

<div id="force_write_through_distributed_cache">
  ## force\_write\_through\_distributed\_cache
</div>

<CloudOnlyBadge />

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.9"},{"label": "auto"},{"label": "単一のクエリに対してサーバー設定 `enable_write_through_distributed_cache` を上書きする新しい設定。"}]}, {"id": "row-2","items": [{"label": "26.8"},{"label": "auto"},{"label": "単一のクエリに対してサーバー設定 `enable_write_through_distributed_cache` を上書きする新しい設定。"}]}]} />

ClickHouse Cloud でのみ有効です。単一のクエリに対してサーバー設定 `enable_write_through_distributed_cache` を上書きします。デフォルトの `auto` は、サーバー設定に従います。
