Use database instead of in-memory data structures