Batch Mechanism
- Last Updated: April 8, 2022
- 1 minute read
- DataDirect Connectors
- ODBC
- PostgreSQL 8.0
- Documentation
Attribute
BatchMechanism (BM)
Purpose
Determines the mechanism that is used to execute batch operations.
Valid Values
1 | 2 | 3 | 4
Behavior
If set to 1 (SingleRowInsert), the driver executes an insert statement for each row contained in a parameter array. Specify this value if you are experiencing out-of-memory errors when performing batch inserts.
If set to 2 (MultiRowInsert), the driver attempts to execute a single insert statement for all the rows contained in a parameter array. If the size of the insert statement exceeds the available buffer memory of the driver, the driver executes multiple statements. Specify this value for substantial performance gains over 1 (SingleRowInsert) when performing batch inserts.
If set to 3 (Copy), the driver uses the PostgreSQL COPY command to insert rows into the target table. Specify this value for substantial performance gains over 1 (SingleRowInsert) when performing batch inserts.
If set to 4 (NativeBatch), the driver uses the PostgreSQL native batch protocol to insert all batched parameters.
Default
3 (Copy)
Notes
- Batch Mechanism determines the mechanism used to perform batch inserts only. For update and delete batch operations, the driver uses the native batch mechanism to handle the request.
- When
BatchMechanism=3, substantial performance gains can be made. However, the following limitations apply:- Individual update counts are not returned. However, the total number of inserted rows are returned the execution of a batch operation.
- The entire batch insert is ATOMIC. If any issues are encountered, the entire operation fails and no rows are inserted.
GUI Tab
See Also
See Performance considerations for details.