Metabase::Archive::SQLite::Sharded - Metabase storage using multiple SQLite databases


version 1.001


  use Metabase::Archive::SQLite::Sharded;

  my $archive = Metabase::Archive::SQLite::Sharded->new(
    filename => $sqlite_file,
    shard_digits => 2,


This is an implementation of the Metabase::Archive::SQL role using SQLite shards.

SQLite stores a database entirely in a single file. That starts to become slow as the size of the file gets large. This Metabase::Archive shards facts across multiple SQLite files.

It takes the same options as Metabase::Archive::SQLite, with one additional option, shard_digits. The shard_digits attribute defines how many digits of the GUID to use as a shard key. Each digit is a hexadecimal number, so digits increase the number of shards as a power of 16. E.g., "1" means 16 shards, "2" means 256 shards and so on.

The shard key is inserted to the database filename parameter either before the final period or at the end. E.g. for shard_digits of "2" and filename "db.sqlite3", the shards would be "db_00.slite3", "db_01.sqlite3", and so on.


  • David Golden <>

  • Leon Brocard <>


This software is Copyright (c) 2011 by David Golden.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004