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

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/OWgITZa_pPE5mzFe/engine/java-sdk/6.1/assets/directquery/composite_database.drawio.png?fit=max\&auto=format\&n=OWgITZa_pPE5mzFe\&q=85\&s=5c085c107fb416bfea4085f335823604)

These isolated tables can be used for instance in measures via a [Copper join](https://docs.activeviam.com/engine/java-sdk/6.1/copper/copper_join.md) or via [get-by-key queries](https://docs.activeviam.com/engine/java-sdk/6.1/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.
