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

# Aggregate tables

export const productName = "Atoti FRTB";

export const coreProductName = "Atoti Server";

# Overview

{coreProductName} [Aggregate Tables](/engine/java-sdk/6.1/directquery/aggregate-tables/) allow {productName} to query a table containing pre-aggregated data rather than having to run expensive aggregation queries on the remote database. This can improve the startup time of {productName} while also lowering compute-related costs on the database.

# Configuration

You can enable aggregate tables with the [`directquery.aggregate-tables`](../configuration-getting-started/configuration-properties#aggregate-tables) configuration properties.

{productName} will need to know the name of the remote database table to use for each aggregate provider of each cube. The aggregate provider configuration can be found in the `DirectQueryAggregateProviderConfig` configuration class. You can use an aggregate table for one or all aggregate providers within {productName}.

Below is an example configuration for the default aggregate providers:

```yaml theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
directquery:
  aggregate-tables:
    enabled: true
    cubes:
      # IMA Cube:
      InternalModelApproachCube:
        aggregate-providers:
          # 1 of 2 Partial-Leaf AggregateProvider within the IMA Cube
          LEAF-Provider-0:
            remote-table-name: INTERNAL_MODEL_APPROACH_CUBE_LEAF_PROVIDER_0_AGGREGATE_TABLE
          # 2 of 2 Partial-Leaf AggregateProvider within the IMA Cube
          LEAF-Provider-1:
            remote-table-name: INTERNAL_MODEL_APPROACH_CUBE_LEAF_PROVIDER_1_AGGREGATE_TABLE
      # SA Cube:
      StandardisedApproachCube:
        aggregate-providers:
          # First and only Partial-Leaf AggregateProvider within the SA Cube
          LEAF-Provider-2:
            remote-table-name: STANDARDISED_APPROACH_CUBE_LEAF_PROVIDER_2_AGGREGATE_TABLE
```

# Generating Aggregate Tables

Aggregate tables can be generated at runtime using the [`DirectQuery REST Service`](./directquery-rest-service##aggregate-tables). Refer to the service for full details on how to generate SQL queries to define and populate the aggregate tables.

# Usage

To use aggregate tables, simply `enable` the aggregate-tables functionality through the `enable` property:

```yaml theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
directquery:
  aggregate-tables:
    enabled: true
```

When {productName} starts, the initial aggregation queries that DirectQuery runs will not compute aggregates, but instead just read the contents of the aggregate tables. This means no computation is performed on the database at startup.
