pub struct BulkOptions {
pub batch_size: usize,
pub check_constraints: bool,
pub fire_triggers: bool,
pub keep_nulls: bool,
pub table_lock: bool,
pub order_hint: Option<Vec<String>>,
pub max_errors: u32,
}Expand description
Options controlling bulk insert behavior.
These options map to SQL Server’s BULK INSERT hints and affect performance, logging, and constraint checking.
Fields§
§batch_size: usizeNumber of rows per batch commit.
Smaller batches use less memory but have more overhead. Larger batches are more efficient but hold locks longer. Default: 0 (single batch for entire operation).
check_constraints: boolCheck constraints during insert.
Default: true
fire_triggers: boolFire INSERT triggers on the table.
Default: false (better performance)
keep_nulls: boolKeep NULL values instead of using column defaults.
Default: true
table_lock: boolAcquire a table-level lock for the duration of the bulk operation.
This can significantly improve performance by reducing lock escalation overhead, but blocks all other access to the table. Default: false
order_hint: Option<Vec<String>>Order hint for the data being inserted.
If data is pre-sorted by the clustered index, specify the columns here to avoid a sort operation on the server. Default: None
max_errors: u32Maximum errors allowed before aborting.
Default: 0 (abort on first error)
Trait Implementations§
Source§impl Clone for BulkOptions
impl Clone for BulkOptions
Source§fn clone(&self) -> BulkOptions
fn clone(&self) -> BulkOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more