diff --git a/docs/content/preview/explore/ysql-language-features/join-strategies.md b/docs/content/preview/explore/ysql-language-features/join-strategies.md index 26e1352f9f0d..c3a03e438333 100644 --- a/docs/content/preview/explore/ysql-language-features/join-strategies.md +++ b/docs/content/preview/explore/ysql-language-features/join-strategies.md @@ -209,7 +209,7 @@ The query plan would be similar to the following: ## Batched nested loop join (BNL) -In the case of Nested loop joins, the inner table is accessed multiple times, once for each outer table row. This leads to multiple RPC requests across the different nodes in the cluster, making this join strategy very slow as the outer table gets larger. +In the case of nested loop joins, the inner table is accessed multiple times, once for each outer table row. This leads to multiple RPC requests across the different nodes in the cluster, making this join strategy very slow as the outer table gets larger. To reduce the number of requests sent across the nodes during the Nested loop join, YugabyteDB adds an optimization to batch multiple keys of the outer table into one RPC request. This batch size can be controlled using the YSQL configuration parameter [yb_bnl_batch_size](../../../reference/configuration/yb-tserver/#yb-bnl-batch-size), which defaults to `1` (which effectively means that the feature is `OFF`). The suggested value for this variable is `1024`. diff --git a/docs/content/preview/reference/configuration/yb-tserver.md b/docs/content/preview/reference/configuration/yb-tserver.md index 56f7a9867369..2ff3b5c91543 100644 --- a/docs/content/preview/reference/configuration/yb-tserver.md +++ b/docs/content/preview/reference/configuration/yb-tserver.md @@ -871,6 +871,14 @@ As long as no data has been flushed from the buffer, the database can retry quer Default: `262144` (256kB, type: int32) +##### --ysql_yb_bnl_batch_size + +Sets the size of a tuple batch that's taken from the outer side of a [batched nested loop (BNL) join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. + +See also the [yb_bnl_batch_size](#yb-bnl-batch-size) configuration parameter. If both flag and parameter are set, the parameter takes precedence. + +Default: 1024 + ### YCQL The following flags support the use of the [YCQL API](../../../api/ycql/): @@ -1721,13 +1729,13 @@ Default: false ##### yb_bnl_batch_size -Set the size of a tuple batch that's taken from the outer side of a [YB Batched Nested Loop (BNL) Join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. +Set the size of a tuple batch that's taken from the outer side of a [batched nested loop (BNL) join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. Default: 1024 ##### yb_enable_batchednl -Enable or disable the query planner's use of Batched Nested Loop Join. +Enable or disable the query planner's use of batched nested loop join. Default: true diff --git a/docs/content/stable/explore/ysql-language-features/join-strategies.md b/docs/content/stable/explore/ysql-language-features/join-strategies.md index c57124f295c4..4e15307c67f7 100644 --- a/docs/content/stable/explore/ysql-language-features/join-strategies.md +++ b/docs/content/stable/explore/ysql-language-features/join-strategies.md @@ -209,7 +209,7 @@ The query plan would be similar to the following: ## Batched nested loop join (BNL) -In the case of Nested loop joins, the inner table is accessed multiple times, once for each outer table row. This leads to multiple RPC requests across the different nodes in the cluster, making this join strategy very slow as the outer table gets larger. +In the case of nested loop joins, the inner table is accessed multiple times, once for each outer table row. This leads to multiple RPC requests across the different nodes in the cluster, making this join strategy very slow as the outer table gets larger. To reduce the number of requests sent across the nodes during the Nested loop join, YugabyteDB adds an optimization to batch multiple keys of the outer table into one RPC request. This batch size can be controlled using the YSQL configuration parameter [yb_bnl_batch_size](../../../reference/configuration/yb-tserver/#yb-bnl-batch-size), which defaults to `1` (which effectively means that the feature is `OFF`). The suggested value for this variable is `1024`. diff --git a/docs/content/stable/reference/configuration/yb-tserver.md b/docs/content/stable/reference/configuration/yb-tserver.md index cfd8e8f5877c..5e6e9179281e 100644 --- a/docs/content/stable/reference/configuration/yb-tserver.md +++ b/docs/content/stable/reference/configuration/yb-tserver.md @@ -863,6 +863,14 @@ As long as no data has been flushed from the buffer, the database can retry quer Default: `262144` (256kB, type: int32) +##### --ysql_yb_bnl_batch_size + +Sets the size of a tuple batch that's taken from the outer side of a [batched nested loop (BNL) join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. + +See also the [yb_bnl_batch_size](#yb-bnl-batch-size) configuration parameter. If both flag and parameter are set, the parameter takes precedence. + +Default: 1024 + ### YCQL The following flags support the use of the [YCQL API](../../../api/ycql/): @@ -1698,13 +1706,13 @@ Default: false ##### yb_bnl_batch_size -Set the size of a tuple batch that's taken from the outer side of a [YB Batched Nested Loop (BNL) Join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. +Set the size of a tuple batch that's taken from the outer side of a [batched nested loop (BNL) join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. Default: 1024 ##### yb_enable_batchednl -Enable or disable the query planner's use of Batched Nested Loop Join. +Enable or disable the query planner's use of batched nested loop join. Default: true diff --git a/docs/content/v2.18/explore/ysql-language-features/join-strategies.md b/docs/content/v2.18/explore/ysql-language-features/join-strategies.md index 10f5a2f3fc72..dffaaf6218d9 100644 --- a/docs/content/v2.18/explore/ysql-language-features/join-strategies.md +++ b/docs/content/v2.18/explore/ysql-language-features/join-strategies.md @@ -209,7 +209,7 @@ The query plan would be similar to the following: ## Batched nested loop join (BNL) -In the case of Nested loop joins, the inner table is accessed multiple times, once for each outer table row. This leads to multiple RPC requests across the different nodes in the cluster, making this join strategy very slow as the outer table gets larger. +In the case of nested loop joins, the inner table is accessed multiple times, once for each outer table row. This leads to multiple RPC requests across the different nodes in the cluster, making this join strategy very slow as the outer table gets larger. To reduce the number of requests sent across the nodes during the Nested loop join, YugabyteDB adds an optimization to batch multiple keys of the outer table into one RPC request. This batch size can be controlled using the YSQL configuration parameter [yb_bnl_batch_size](../../../reference/configuration/yb-tserver/#yb-bnl-batch-size), which defaults to `1` (which effectively means that the feature is `OFF`). The suggested value for this variable is `1024`. diff --git a/docs/content/v2.18/reference/configuration/yb-tserver.md b/docs/content/v2.18/reference/configuration/yb-tserver.md index 968005fb4d4d..b0b8a3ca6a40 100644 --- a/docs/content/v2.18/reference/configuration/yb-tserver.md +++ b/docs/content/v2.18/reference/configuration/yb-tserver.md @@ -645,6 +645,14 @@ Default: `-1` (disables logging statement durations) Specifies the lowest YSQL message level to log. +##### --ysql_yb_bnl_batch_size + +Sets the size of a tuple batch that's taken from the outer side of a [batched nested loop (BNL) join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. + +See also the [yb_bnl_batch_size](#yb-bnl-batch-size) configuration parameter. If both flag and parameter are set, the parameter takes precedence. + +Default: 1024 + ### YCQL The following flags support the use of the [YCQL API](../../../api/ycql/): @@ -1210,13 +1218,13 @@ Default: `1GB` ##### yb_bnl_batch_size -Set the size of a tuple batch that's taken from the outer side of a [YB Batched Nested Loop (BNL) Join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. +Set the size of a tuple batch that's taken from the outer side of a [batched nested loop (BNL) join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. Default: 1024 ##### yb_enable_batchednl -Enable or disable the query planner's use of Batched Nested Loop Join. +Enable or disable the query planner's use of batched nested loop join. Default: true diff --git a/docs/content/v2.20/explore/ysql-language-features/join-strategies.md b/docs/content/v2.20/explore/ysql-language-features/join-strategies.md index bb4f4424d8c6..9ef941698c98 100644 --- a/docs/content/v2.20/explore/ysql-language-features/join-strategies.md +++ b/docs/content/v2.20/explore/ysql-language-features/join-strategies.md @@ -209,7 +209,7 @@ The query plan would be similar to the following: ## Batched nested loop join (BNL) -In the case of Nested loop joins, the inner table is accessed multiple times, once for each outer table row. This leads to multiple RPC requests across the different nodes in the cluster, making this join strategy very slow as the outer table gets larger. +In the case of nested loop joins, the inner table is accessed multiple times, once for each outer table row. This leads to multiple RPC requests across the different nodes in the cluster, making this join strategy very slow as the outer table gets larger. To reduce the number of requests sent across the nodes during the Nested loop join, YugabyteDB adds an optimization to batch multiple keys of the outer table into one RPC request. This batch size can be controlled using the YSQL configuration parameter [yb_bnl_batch_size](../../../reference/configuration/yb-tserver/#yb-bnl-batch-size), which defaults to `1` (which effectively means that the feature is `OFF`). The suggested value for this variable is `1024`. diff --git a/docs/content/v2.20/reference/configuration/yb-tserver.md b/docs/content/v2.20/reference/configuration/yb-tserver.md index 75073fcda92e..de2a8a6871f5 100644 --- a/docs/content/v2.20/reference/configuration/yb-tserver.md +++ b/docs/content/v2.20/reference/configuration/yb-tserver.md @@ -740,6 +740,14 @@ As long as no data has been flushed from the buffer, the database can retry quer Default: `262144` (256kB, type: int32) +##### --ysql_yb_bnl_batch_size + +Sets the size of a tuple batch that's taken from the outer side of a [batched nested loop (BNL) join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. + +See also the [yb_bnl_batch_size](#yb-bnl-batch-size) configuration parameter. If both flag and parameter are set, the parameter takes precedence. + +Default: 1024 + ### YCQL The following flags support the use of the [YCQL API](../../../api/ycql/): @@ -1370,13 +1378,13 @@ Default: `1GB` ##### yb_bnl_batch_size -Set the size of a tuple batch that's taken from the outer side of a [YB Batched Nested Loop (BNL) Join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. +Set the size of a tuple batch that's taken from the outer side of a [batched nested loop (BNL) join](../../../explore/ysql-language-features/join-strategies/#batched-nested-loop-join-bnl). When set to 1, BNLs are effectively turned off and won't be considered as a query plan candidate. Default: 1024 ##### yb_enable_batchednl -Enable or disable the query planner's use of Batched Nested Loop Join. +Enable or disable the query planner's use of batched nested loop join. Default: true