improved performance of database access by caching primary keys