Business Insights AI Agent using CDGC Metadata Discovery > Introduction to Business Insights AI Agent using CDGC Metadata Discovery recipe > Enhance SQL accuracy with relationship extraction
  

Enhance SQL accuracy with relationship extraction

The relationship extraction option in the AI agent retrieves additional metadata about connections between tables, such as foreign keys, which may not be evident from column names or descriptions alone. This capability enables the agent to construct accurate SQL queries with correct JOIN conditions, reducing errors caused by ambiguous or unclear column names.
This option is particularly useful in the following cases:
By enabling relationship extraction, users gain greater accuracy in SQL query generation and more consistent results. However, this comes at the cost of longer execution times due to the need to fetch and process additional metadata.
Therefore, it is recommended to keep this option disabled by default and enable it only for complex scenarios that require precise understanding of table relationships.
For more information about enabling and disabling relationship extraction, see Step 4. Configure the agent flow.