I'd like to request some general advice on *local* databases ...
So... tips? Conventional wisdom? Pitfalls? What to watch out for? That kind of stuff.
For fun, let's start with my top ten list of general software development practices
(adapted from On Coding Standards and Code Reviews):
- Correctness, simplicity and clarity come first. Avoid unnecessary cleverness.
- Systems should be designed as a set of cohesive modules as loosely coupled as is reasonably feasible.
- Minimize exposure of module implementation; provide stable interfaces to protect programs from the details of the implementation (which are likely to change).
- Design components that can be easily tested in isolation.
- Add new test cases before you start debugging.
- Adopt a policy of zero tolerance for warnings and errors.
- Establish a rational error handling policy and follow it strictly. Handle all errors (e.g. don't ignore error returns). Fail securely.
- Use least privilege; only run with superuser privilege when you need to.
- Don't optimize prematurely. Benchmark before you optimize. Comment why you are optimizing.
- Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
So I'd start by defining your "local database interface" based on your requirements.
You could then try an implementation of it using, for example, the excellent suggestions above from the Discipulus.
If your interface is well designed, you could further experiment with different implementations of it,
based on your requirements.
If performance was crucial, for example, you could benchmark alternative
implementations of your local database interface using different technologies -
comparing the performance of built-in Perl hashes with a SQLite memory-based database and Judy Arrays, for example.
If performance is critical for your application, you might be interested in: