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

# ajustes de sesión de optimize_aggregation_in_order_*

> Ajustes de sesión de ClickHouse en el grupo generado optimize_aggregation_in_order_*.

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
  }}>Tipo</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>Predeterminado</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          Modificable sin reiniciar
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

Estos ajustes están disponibles en [system.settings](/docs/es/reference/system-tables/settings) y se autogeneran a partir del [código fuente](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp).

<div id="optimize_aggregation_in_order">
  ## optimize\_aggregation\_in\_order
</div>

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

Habilita la optimización de [GROUP BY](/docs/es/reference/statements/select/group-by) en consultas [SELECT](/docs/es/reference/statements/select/index) para agregar datos siguiendo el orden correspondiente en tablas [MergeTree](/docs/es/reference/engines/table-engines/mergetree-family/mergetree).

Valores posibles:

* 0 — la optimización de `GROUP BY` está deshabilitada.
* 1 — la optimización de `GROUP BY` está habilitada.

**Véase también**

* [Optimización de GROUP BY](/docs/es/reference/statements/select/group-by#group-by-optimization-depending-on-table-sorting-key)

<div id="optimize_aggregation_in_order_limit">
  ## optimize\_aggregation\_in\_order\_limit
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "1"},{"label": "Nueva configuración para aplicar `LIMIT` a la agregación en orden y permitir la finalización temprana cuando `ORDER BY` es un prefijo de la descripción de ordenación de `GROUP BY`."}]}]} />

Cuando está habilitada y la agregación en orden está activa, aplica LIMIT en el paso de agregación para permitir la finalización temprana una vez que se han producido suficientes grupos. Esto reduce la cantidad de datos leídos cuando ORDER BY coincide con el prefijo de la clave de GROUP BY. Puede reducir el valor devuelto por `rows_before_limit_at_least`; use `exact_rows_before_limit` si necesita recuentos exactos.
