question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: array binding support for CommandInfo and/or BulkCopy

See original GitHub issue

Some data providers like Oracle and DB2 provide array binding feature (supported by BLToolkit).

It works like this: the command is sent to the database server in one roundtrip, but is executed multiple times as needed. Scalar parameters are sent as arrays, and each command execution takes the next set of parameters.

Pseudocode:

var cmd = new OracleCommand();
cmd.CommantText = @"INSERT INTO MY_TABLE(ID, NAME, COMMENT) VALUES(:ID, :NAME, :COMMENT)";
cmd.ArrayBindCount = 5;

cmd.Parameters.Add("ID", new[] { 1, 2, 3, 4, 5 }); // each array has ArrayBindCount elements
cmd.Parameters.Add("NAME", new[] { "1", "2", "3", "4", "5" });
cmd.Parameters.Add("COMMENT", new[] { "One", "Two", "Three", "Four", "Five" });

On the database side, it’s equivalent to repeating the same INSERT statement 5 times, with parameters (1, “1”, “One”), then (2, “2”, “Two”), and so on. But it’s executed much faster than individual INSERTs and with less traffic.

Can we add support for this execution mode to CommandInfo and/or BulkCopy? The default implementation for data providers that don’t support array binding would fall back to multiple execution of the same statement.

Related issue: #1880

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
sdanylivcommented, Mar 14, 2021

@yallie, looks like it is already implemented. Try to set OracleTools.UseAlternativeBulkCopy = true and BulkCopy should switch to this implementation.

0reactions
yalliecommented, Mar 14, 2021

@jods4, thanks for confirming that!

Read more comments on GitHub >

github_iconTop Results From Across the Web

performance - Oracle Array Binding vs Oracle Bulk copy
In my local when I tried, I saw Array binding is faster compared to Bulk copy. Then question remains what is the purpose...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found