[DBD-SQLite] DBI, DBD::SQLite and threads

Martin J. Evans martin.evans at easysoft.com
Mon Mar 19 08:42:04 GMT 2012

On 19/03/12 04:19, Adam Kennedy wrote:
> I've noticed there's a lot of movement at the moment on DBI, threading
> and performance.
> http://www.martin-evans.me.uk/node/131

The issue here was that when using a threaded Perl the state structure had to be protected and there was a slow and a faster way of accessing it. Some DBDs were using the slow method.

> In Padre we've always stuck to the use of DBI only in the parent
> thread, but the time is fast approaching where it would be very handy
> to run multiple database connections for things like background
> indexing of code and the like.

When you build DBI it still says:

*** You are using a perl configured with threading enabled.
*** You should be aware that using multiple threads is
*** not recommended for production environments.

but I'm unsure to what degree this still applies.

Some DBDs are still littered with dTHR macros which as far as I am aware has been a noop since Perl 5.8.
> I was wondering if anyone has any experiences with DBD::SQLite and
> threads, or can speak with some authority on where we are with regards
> to them (I do know that the CLONE method seems to blank out the driver
> structure forcing it to load again in the new thread).
> Regardless of whether they currently work or not, I'd like to be able
> to write a =head2 section in the POD documentation stating our current
> position on threads and recommendations before the next release.
> If they can be used in threads, it would be nice to be able to write a
> DBD::SQLite::Cookbook entry on using threads.
> I'm happy to do the POD writing myself if someone wants to just reply
> with information to the mailing list.
> Thanks all
> Adam K

I'm afraid I neither use a Perl with threads enabled or threads - which is a shame as I didn't see any benefit from that huge change to DBD::Oracle.

I note DBD::SQLite does not seem to be using the DBIS macro so there is nothing to change.

Sorry that does not necessarily help you with SQLite and using threads.

Martin J. Evans
Easysoft Limited

More information about the DBD-SQLite mailing list