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

# aggregateGroupByRaw

<div className="kinetica-doxygen">
  <div id="a229b78476fee686199caaa9de5a113b2" />

  <h2 className="memtitle"><span className="permalink"><a href="#a229b78476fee686199caaa9de5a113b2">◆ </a></span>aggregateGroupByRaw() <span className="overload">\[1/2]</span></h2>

  <div className="memitem">
    <div className="memproto">
      <table className="memname">
        <tr>
          <td className="memname"><a className="el" href="/content/api/cpp/structgpudb_1_1RawAggregateGroupByResponse">RawAggregateGroupByResponse</a> gpudb::GPUdb::aggregateGroupByRaw </td>
          <td>(</td>
          <td className="paramtype">const <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest">AggregateGroupByRequest</a> &</td>
          <td className="paramname"><span className="paramname"><span className="em">request\_</span></span></td>
          <td>)</td>
          <td> const</td>
        </tr>
      </table>
    </div>

    <div className="memdoc">
      <p>Calculates unique combinations (groups) of values for the given columns in a given table or view and computes aggregates on each unique combination. </p>
      <p>This is somewhat analogous to an SQL-style SELECT...GROUP BY.</p>
      <p>For aggregation details and examples, see <a href="/content/concepts/aggregation/" target="_top">Aggregation</a>. For limitations, see <a href="/content/concepts/aggregation/#limitations" target="_top">Aggregation Limitations</a>.</p>
      <p>Any column(s) can be grouped on, and all column types except unrestricted-length strings may be used for computing applicable aggregates.</p>
      <p>The results can be paged via the <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#ad33d5ef5e1c47ab8c549ddad114ee63e">offset</a> and <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a5765d2623bfa7ac83104f43748a8bcb1">limit</a> parameters. For example, to get 10 groups with the largest counts the inputs would be: limit=10, options={"{"}"sort\_order":"descending", "sort\_by":"value"{"}"}.</p>
      <p><a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a7fb83ff0c7bd454e13268cdfb9c81db4">options</a> can be used to customize behavior of this call e.g. filtering or sorting the results.</p>
      <p>To group by columns 'x' and 'y' and compute the number of objects within each group, use: column\_names=\['x','y','count(\*)'].</p>
      <p>To also compute the sum of 'z' over each group, use: column\_names=\['x','y','count(\*)','sum(z)'].</p>
      <p>Available <a href="/content/concepts/expressions/#aggregate-expressions" target="_top">aggregation functions</a> are: count(\*), sum, min, max, avg, mean, stddev, stddev\_pop, stddev\_samp, var, var\_pop, var\_samp, arg\_min, arg\_max and count\_distinct.</p>
      <p>Available grouping functions are <a href="/content/concepts/rollup/" target="_top">Rollup</a>, <a href="/content/concepts/cube/" target="_top">Cube</a>, and <a href="/content/concepts/grouping_sets/" target="_top">Grouping Sets</a></p>
      <p>This service also provides support for <a href="/content/concepts/pivot/" target="_top">Pivot</a> operations.</p>
      <p>Filtering on aggregates is supported via expressions using <a href="/content/concepts/expressions/#aggregate-expressions" target="_top">aggregation functions</a> supplied to <a className="el" href="/content/api/cpp/namespacegpudb#ad1ab7a16358f987414622becec705d1f">having</a>.</p>
      <p>The response is returned as a dynamic schema. For details see: <a href="/content/api/concepts/#dynamic-schemas" target="_top">dynamic schemas documentation</a>.</p>
      <p>If a <a className="el" href="/content/api/cpp/namespacegpudb#a74372aa877ab6529947b269da9d4ae00">result\_table</a> name is specified in the <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a7fb83ff0c7bd454e13268cdfb9c81db4">options</a>, the results are stored in a new table with that name–no results are returned in the response. Both the table name and resulting column names must adhere to <a href="/content/concepts/tables/#table" target="_top">standard naming conventions</a>; column/aggregation expressions will need to be aliased. If the source table's <a href="/content/concepts/tables/#shard-keys" target="_top">shard key</a> is used as the grouping column(s) and all result records are selected (<a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#ad33d5ef5e1c47ab8c549ddad114ee63e">offset</a> is 0 and <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a5765d2623bfa7ac83104f43748a8bcb1">limit</a> is -9999), the result table will be sharded, in all other cases it will be replicated. Sorting will properly function only if the result table is replicated or if there is only one processing node and should not be relied upon in other cases. Not available when any of the values of <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a8e3cb49fb147d79eec5ec008d999a2cd">columnNames</a> is an unrestricted-length string.</p>

      <div className="dl params">
        <div className="dt">Parameters</div>

        <div className="dd">
          <table className="params">
            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">request\_</td>
              <td><a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest">Request</a> object containing the parameters for the operation.</td>
            </tr>
          </table>
        </div>
      </div>

      <div className="dl section return">
        <div className="dt">Returns</div>
        <div className="dd"><a className="el" href="/content/api/cpp/structgpudb_1_1RawAggregateGroupByResponse">Response</a> object containing the result of the operation. </div>
      </div>
    </div>
  </div>

  <div id="a7660bce798a03aa6d1512429d1e72401" />

  <h2 className="memtitle"><span className="permalink"><a href="#a7660bce798a03aa6d1512429d1e72401">◆ </a></span>aggregateGroupByRaw() <span className="overload">\[2/2]</span></h2>

  <div className="memitem">
    <div className="memproto">
      <table className="memname">
        <tr>
          <td className="memname"><a className="el" href="/content/api/cpp/structgpudb_1_1RawAggregateGroupByResponse">RawAggregateGroupByResponse</a> & gpudb::GPUdb::aggregateGroupByRaw </td>
          <td>(</td>
          <td className="paramtype">const <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest">AggregateGroupByRequest</a> &</td>
          <td className="paramname"><span className="paramname"><span className="em">request\_</span></span>, </td>
        </tr>

        <tr>
          <td className="paramkey" />

          <td />

          <td className="paramtype"><a className="el" href="/content/api/cpp/structgpudb_1_1RawAggregateGroupByResponse">RawAggregateGroupByResponse</a> &</td>
          <td className="paramname"><span className="paramname"><span className="em">response\_</span></span> ) const</td>
        </tr>
      </table>
    </div>

    <div className="memdoc">
      <p>Calculates unique combinations (groups) of values for the given columns in a given table or view and computes aggregates on each unique combination. </p>
      <p>This is somewhat analogous to an SQL-style SELECT...GROUP BY.</p>
      <p>For aggregation details and examples, see <a href="/content/concepts/aggregation/" target="_top">Aggregation</a>. For limitations, see <a href="/content/concepts/aggregation/#limitations" target="_top">Aggregation Limitations</a>.</p>
      <p>Any column(s) can be grouped on, and all column types except unrestricted-length strings may be used for computing applicable aggregates.</p>
      <p>The results can be paged via the <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#ad33d5ef5e1c47ab8c549ddad114ee63e">offset</a> and <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a5765d2623bfa7ac83104f43748a8bcb1">limit</a> parameters. For example, to get 10 groups with the largest counts the inputs would be: limit=10, options={"{"}"sort\_order":"descending", "sort\_by":"value"{"}"}.</p>
      <p><a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a7fb83ff0c7bd454e13268cdfb9c81db4">options</a> can be used to customize behavior of this call e.g. filtering or sorting the results.</p>
      <p>To group by columns 'x' and 'y' and compute the number of objects within each group, use: column\_names=\['x','y','count(\*)'].</p>
      <p>To also compute the sum of 'z' over each group, use: column\_names=\['x','y','count(\*)','sum(z)'].</p>
      <p>Available <a href="/content/concepts/expressions/#aggregate-expressions" target="_top">aggregation functions</a> are: count(\*), sum, min, max, avg, mean, stddev, stddev\_pop, stddev\_samp, var, var\_pop, var\_samp, arg\_min, arg\_max and count\_distinct.</p>
      <p>Available grouping functions are <a href="/content/concepts/rollup/" target="_top">Rollup</a>, <a href="/content/concepts/cube/" target="_top">Cube</a>, and <a href="/content/concepts/grouping_sets/" target="_top">Grouping Sets</a></p>
      <p>This service also provides support for <a href="/content/concepts/pivot/" target="_top">Pivot</a> operations.</p>
      <p>Filtering on aggregates is supported via expressions using <a href="/content/concepts/expressions/#aggregate-expressions" target="_top">aggregation functions</a> supplied to <a className="el" href="/content/api/cpp/namespacegpudb#ad1ab7a16358f987414622becec705d1f">having</a>.</p>
      <p>The response is returned as a dynamic schema. For details see: <a href="/content/api/concepts/#dynamic-schemas" target="_top">dynamic schemas documentation</a>.</p>
      <p>If a <a className="el" href="/content/api/cpp/namespacegpudb#a74372aa877ab6529947b269da9d4ae00">result\_table</a> name is specified in the <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a7fb83ff0c7bd454e13268cdfb9c81db4">options</a>, the results are stored in a new table with that name–no results are returned in the response. Both the table name and resulting column names must adhere to <a href="/content/concepts/tables/#table" target="_top">standard naming conventions</a>; column/aggregation expressions will need to be aliased. If the source table's <a href="/content/concepts/tables/#shard-keys" target="_top">shard key</a> is used as the grouping column(s) and all result records are selected (<a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#ad33d5ef5e1c47ab8c549ddad114ee63e">offset</a> is 0 and <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a5765d2623bfa7ac83104f43748a8bcb1">limit</a> is -9999), the result table will be sharded, in all other cases it will be replicated. Sorting will properly function only if the result table is replicated or if there is only one processing node and should not be relied upon in other cases. Not available when any of the values of <a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest#a8e3cb49fb147d79eec5ec008d999a2cd">columnNames</a> is an unrestricted-length string.</p>

      <div className="dl params">
        <div className="dt">Parameters</div>

        <div className="dd">
          <table className="params">
            <tr>
              <td className="paramdir">\[in]</td>
              <td className="paramname">request\_</td>
              <td><a className="el" href="/content/api/cpp/structgpudb_1_1AggregateGroupByRequest">Request</a> object containing the parameters for the operation. </td>
            </tr>

            <tr>
              <td className="paramdir">\[out]</td>
              <td className="paramname">response\_</td>
              <td><a className="el" href="/content/api/cpp/structgpudb_1_1RawAggregateGroupByResponse">Response</a> object containing the results of the operation.</td>
            </tr>
          </table>
        </div>
      </div>

      <div className="dl section return">
        <div className="dt">Returns</div>
        <div className="dd"><a className="el" href="/content/api/cpp/structgpudb_1_1RawAggregateGroupByResponse">Response</a> object containing the result of the operation (initially passed in by reference). </div>
      </div>
    </div>
  </div>
</div>
