Open and close the database once per buffer, instead of once per url