Skip to content

Commit

Permalink
[doc] ysql_yb_bnl_batch_size flag (#23397)
Browse files Browse the repository at this point in the history
* ysql_yb_bnl_batch_size flag

* review comment
  • Loading branch information
ddhodge authored Aug 8, 2024
1 parent 71ab66f commit 4768023
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
12 changes: 10 additions & 2 deletions docs/content/preview/reference/configuration/yb-tserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/):
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
12 changes: 10 additions & 2 deletions docs/content/stable/reference/configuration/yb-tserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/):
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
12 changes: 10 additions & 2 deletions docs/content/v2.18/reference/configuration/yb-tserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/):
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
12 changes: 10 additions & 2 deletions docs/content/v2.20/reference/configuration/yb-tserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4768023

Please sign in to comment.