Batch Size
Uncontrolled node
Overview
The Batch Size node returns the configured number of items to be processed in each batch when a workflow is running in batch mode. This is useful for workflows that need to process large datasets in chunks, allowing you to know exactly how many records are being handled in the current batch iteration.
Unlike the Batch Length node (which returns the total number of items across all batches) or the Batch Index node (which returns the current batch number), the Batch Size node returns the fixed size limit configured for each individual batch.
This node is designed to work alongside the Batch Data node. When a workflow is configured to run in batch mode, the system automatically sets batch options (batchOpts) that include the batch size, which this node reads and outputs.
Inputs
This node has no inputs.
Outputs
| Output | Type | Description |
|---|---|---|
| Size | Number | The number of items configured to be processed in each batch. Returns 0 if the workflow is not running in batch mode or if no batch size is configured. |
Runtime Behavior and Defaults
When the workflow runs in batch mode, the node retrieves the batchSize value from the workflow's internal batch options (batchOpts).
- Default Value:
0(returned when not in batch mode) - Data Source: Reads from
rootWorkflow.getData('batchOpts').batchSize - Execution: As an uncontrolled node, it outputs data immediately without requiring an event trigger
The batch size is typically configured when setting up batch processing for database queries or large dataset operations, representing the LIMIT value in SQL terms (e.g., "process 100 records at a time").
Example Usage
Basic Batch Processing Setup
Connect the Batch Size node to understand the capacity of each batch iteration:
[Batch Data] → (data) → [Process Items]
↓
[Batch Size] → (size) → [Display: "Processing {{size}} items per batch"]
Pagination Logic
Use the batch size to calculate offsets or progress within a batch:
[Batch Index] → (index) → [Multiply] → (result) → [Calculate Offset]
↑ ↑
[Batch Size] → (size) ───────────────────────┘
In this example, multiplying the batch index by the batch size gives you the starting offset for the current batch (e.g., batch index 2 with size 100 = offset 200).
Conditional Processing
Check if the batch size is valid before proceeding:
[Batch Size] → (size) → [Compare] → (true) → [Run Processing]
↑
[Value: 0]
[Operation: >]
This ensures your workflow only attempts to process data when a valid batch size is configured.