Add optional triggered procedure to prune stats table

This is useful for deployments with free tier on Heroku.

It is my first trigger and I'm not sure what's best, BEFORE or AFTER INSERT OR UPDATE.

This might close #4