Subject | Re: [Firebird-Architect] Bulk loader. |
---|---|
Author | Vlad Khorsun |
Post date | 2007-11-04T07:43:42Z |
>> For speed no unique\foreign constraints must be checked during bulkIts my personal opinion based on profling of different FB operations such as
>> insert. All this constraints will be checked at the end of bulk insertion
>> during index merge\rebuild phase. Another (not perfect but possible) way
>> is to disallow bulk insert into table which have such constraints.
>
> Is that your personal opinion or result of the discussion with people
> that asked this feature?
insert and FK index build.
> What about other engines like Oracle or MS SQL?MSSQL have command-line BCP (buck copy) utility and BULK INSERT
statement and allow to ignore any constraints and disable insert triggers.
More - this is default behavior :
BULK INSERT [ [ 'database_name'.] [ 'owner' ].] { 'table_name' FROM 'data_file' }
[ WITH
(
[ BATCHSIZE [ = batch_size ] ]
[ [ , ] CHECK_CONSTRAINTS ]
[ [ , ] CODEPAGE [ = 'ACP' | 'OEM' | 'RAW' | 'code_page' ] ]
[ [ , ] DATAFILETYPE [ =
{ 'char' | 'native'| 'widechar' | 'widenative' } ] ]
[ [ , ] FIELDTERMINATOR [ = 'field_terminator' ] ]
[ [ , ] FIRSTROW [ = first_row ] ]
[ [ , ] FIRE_TRIGGERS ]
[ [ , ] FORMATFILE = 'format_file_path' ]
[ [ , ] KEEPIDENTITY ]
[ [ , ] KEEPNULLS ]
[ [ , ] KILOBYTES_PER_BATCH [ = kilobytes_per_batch ] ]
[ [ , ] LASTROW [ = last_row ] ]
[ [ , ] MAXERRORS [ = max_errors ] ]
[ [ , ] ORDER ( { column [ ASC | DESC ] } [ ,...n ] ) ]
[ [ , ] ROWS_PER_BATCH [ = rows_per_batch ] ]
[ [ , ] ROWTERMINATOR [ = 'row_terminator' ] ]
[ [ , ] TABLOCK ]
)
]
CHECK_CONSTRAINTS
Specifies that any constraints on table_name are checked during the bulk copy operation.
By default, constraints are ignored. Note that the MAX_ERRORS option does not apply to constraint checking.
FIRE_TRIGGERS
Specifies that any insert triggers defined on the destination table will execute during the bulk copy operation.
If FIRE_TRIGGERS is not specified, no insert triggers will execute.
KEEPNULLS
Specifies that empty columns should retain a null value during the bulk copy operation, rather than have any
default values for the columns inserted.
TABLOCK
Specifies that a table-level lock is acquired for the duration of the bulk copy operation. A table can be loaded
concurrently by multiple clients if the table has no indexes and TABLOCK is specified
Permissions
Only members of the sysadmin and bulkadmin fixed server roles can execute BULK INSERT.
Regards,
Vlad