Well, it seems that no, as far as journaling is disabled.
#!/usr/bin/perl use strict; use warnings; use POSIX qw(_exit); use DBI; use File::Temp; $| = 1; my $dbfile = "/tmp/db-$$"; my $dbh = DBI->connect("dbi:SQLite:$dbfile", "", "", {RaiseError => 1} +); $dbh->do("create table queue (child, ix)"); for my $id (0..3) { fork or do { print "<$id enter>"; my $dbh = DBI->connect("dbi:SQLite:$dbfile", "", "", {RaiseErr +or => 1}); $dbh->do("PRAGMA journal_mode = OFF"); my $sth; while (not defined $sth) { $sth = eval { $dbh->prepare("insert into queue values (?, +?)") }; } print "<$id with sth>"; for (1..1000) { eval { $sth->execute($id, $_); print $id; }; $@ and print "<$id error: $@>" }; print "<$id exit>"; _exit(0); } } 1 while (wait > 0); my $sth = $dbh->prepare("select count(*) from queue"); $sth->execute; my $row = $sth->fetchrow_arrayref; print "\n@$row\n";
On my Linux box it does 4000 insertions in 35 seconds and having several concurrent processes accessing the same database does not affect its performance noticeably.

update: It seems that even better than disabling the journal, it is to disable synchronous writes (= ensuring that written data actually gets into the disk surface):

$dbh->do("PRAGMA synchronous = OFF");

That makes 4000 inserts in 2.5 seconds in my computer, and is safer as the database would not get corrupted unless the OS failed to flush cache data to disk.


In reply to Re^3: A per-instance shared queue among forked child processes? by salva
in thread A per-instance shared queue among forked child processes? by EvanK

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.