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

<Frame>
  <img src="https://mintcdn.com/activeviam/KszPZqdDnmT6EpJc/engine/java-sdk/6.1/assets/directquery/composite_database.drawio.png?fit=max&auto=format&n=KszPZqdDnmT6EpJc&q=85&s=cf19674fab57f7da9b14df7019e0bc35" alt="Composite DirectQuery database" width="696" height="231" data-path="engine/java-sdk/6.1/assets/directquery/composite_database.drawio.png" />
</Frame>

These isolated tables can be used for instance in measures via a [Copper join](../../copper/copper_join) or via [get-by-key queries](../../database/database_queries/#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.
