Any chances to perform parallel (multithreaded) INSERTs?



Hi all,

with my Perl script I have to upload large amounts of data into various
tables of a SQL Server database. The actual upload process takes some (too
much) time although I am already using prepared statements. I am using
ithreads in my script so it would be easy to speed up the upload process
by parallelizing the INSERTs. Unfortunately this doesn't work: DBI
remembered me of some issues:

Thread 12 terminated abnormally: DBD::ODBC::db prepare
failed: handle 2 is owned by thread 100103370 not current
thread 108773770 (handles can't be shared between threads
and your driver may need a CLONE method added)

The explanation in the DBI docs finally put me over the edge that there is
an easy way of parallelizing:

Threads and Thread Safety
[...]
However, the internal pointer data within the handles will
refer to the DBI and drivers in the original interpreter.
Using those handles in the new interpreter thread is not
safe, so the DBI detects this and croaks on any method call
using handles that don't belong to the current thread
(except for DESTROY).

Now I am wondering if there are still any chances to workaround this and
to parallelize the INSERTs. My SQL statements are covered by a transaction
so I cannot let my threads create a database handle individually.

The Unix (Solaris) part of the ecosystem consists of Perl 5.8.8, DBI,
DBD::ODBC, unixODBC, and FreeTDS. The database is a Microsoft SQL Server
2005 database.

Thanks for your help!

Stephan

.



Relevant Pages

  • Re: How to access MS Access from Perl?
    ... if you were to later migrate to MS SQL Server or Oracle ... minimize your load on the database server's compiled procedure cache. ... On the other hand, if startup time for your perl script is an issue, and ... slightly preferable to the bulkier DBI + DBD::ODBC. ...
    (comp.lang.perl)
  • Ruby DBI Error
    ... I have been using Ruby v1.8.2 with DBI v1.42 for awhile now and it has ... OLE error code:80040E4D in Microsoft OLE DB Provider for SQL Server ... This database requires SQL security so I can't get it to Windows ...
    (comp.lang.ruby)
  • Re: DBD for SQL Server?
    ... > Is there a DBD for SQL Server so that I can connect ... > 2000 database with DBI? ... Windows uses the Open Database Connectivity ... Do you Yahoo!? ...
    (perl.beginners)
  • DBD for SQL Server?
    ... Is there a DBD for SQL Server so that I can connect to our SQL Server ... 2000 database with DBI? ... I've hunted all over CPAN but I can't seem to ...
    (perl.beginners)
  • Re: MS Access DAO -> ADO.NET Migration
    ... William Vaughn ... Microsoft MVP ... Hitchhiker's Guide to Visual Studio and SQL Server ... My migration app works building a SSCE database file with imported data ...
    (microsoft.public.dotnet.framework.adonet)

Loading