Back to Shardingsphere

Sql Federation.En

docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/sql-federation.en.md

5.5.32.1 KB
Original Source

+++ title = "SQL-federation" weight = 13 +++

Background

This function is an experimental one and is currently not suitable for use in core system production environments. When multiple tables in a join query are distributed across different database instances, enabling federated query allows for cross-database join queries, as well as subqueries.

Parameters

Class: org.apache.shardingsphere.sqlfederation.config.SQLFederationRuleConfiguration

Attributes:

nameDataTypeDescriptionDefault Value
sqlFederationEnabledbooleanSQL federation enabled configuration-
allQueryUseSQLFederationbooleanall query use SQL federation configuration-
executionPlanCacheorg.apache.shardingsphere.sql.parser.api.CacheOptionexecution plan cache configuration-

Cache option Configuration

Class: org.apache.shardingsphere.sql.parser.api.CacheOption

Attributes:

nameDataTypeDescriptionDefault Value
initialCapacityintInitial capacity of local cacheexecution plan local cache default value of 2000
maximumSizelongMaximum capacity of local cacheexecution plan local cache maximum default value 65535

Sample

java
private SQLFederationRuleConfiguration createSQLFederationRuleConfiguration() {
    CacheOption executionPlanCache = new CacheOption(2000, 65535L);
    return new SQLFederationRuleConfiguration(true, false, executionPlanCache);
}