App-Chronicle

 view release on metacpan or  search on metacpan

lib/Chronicle/Plugin/DBTweak.pm  view on Meta::CPAN


=head1 NAME

Chronicle::Plugin::DBTweak - Speedup the import process

=head1 DESCRIPTION

This plugin is responsible for turning off database synchronization,
which results in a significantly faster import process.

The downside is that we're at risk of data-lass within the SQLite
database because we're not relying upon the operating system to sync
the database between inserts.

For our use-case this is not a concern.

=cut

lib/Chronicle/Plugin/DBTweak.pm  view on Meta::CPAN

Here we set the pragmas to speedup the insertion process of new entries.

=cut

sub on_db_load
{
    my ( $self, %args ) = (@_);

    my $dbh = $args{ 'dbh' };

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


1;


=head1 LICENSE

This module is free software; you can redistribute it and/or modify it



( run in 0.309 second using v1.01-cache-2.11-cpan-0d8aa00de5b )