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

# Composite Database

> How to combine external tables and Atoti Datastore in-memory tables within a single Atoti DirectQuery schema, where in-memory stores remain isolated and enable faster measure computation via get-by-key queries without external database round-trips

DirectQuery schema can have both external tables and in-memory Datastore tables.
However, it's important to note that joins between external tables and in-memory ones are **not** possible.
In other words, the in-memory tables can only exist as isolated stores. In-memory tables are not directly linked to the base table.

![Composite DirectQuery database](https://mintcdn.com/activeviam/tQvlpZIn_EhELfJK/engine/java-sdk/6.2/assets/directquery/composite_database.drawio.png?fit=max\&auto=format\&n=tQvlpZIn_EhELfJK\&q=85\&s=dcdd03b2cad0067c3565e6ed12470964)

These isolated tables can be used for instance in measures via a [Copper join](https://docs.activeviam.com/engine/java-sdk/6.2/copper/copper_join.md) or via [get-by-key queries](https://docs.activeviam.com/engine/java-sdk/6.2/database/database_queries.md#get-by-key-queries).
Having this data in-memory avoids a round-trip to the external database (which includes network calls) when computing the measures.
For instance, if some get-by-key queries are executed for a lot of locations in a measure, having a local datastore can make the query a lot faster.
