Well, using the Map would be an in-memory operation (CPU-bound as they say), while the Database operation would be an IO operation (ergo, IO-bound). As you probably know, any IO stuff a computer does is slow[er]. So, it would definitely be more efficient (memory-wise) to use the in-memory Map at that point.
There are probably other issues though, if you're asking this question at all.
We cache things from the database into maps in memory all the time. Every time it's a gamble that the peformance improvement is worth the memory cost. If we run out of memory, we may have bet too much on caching.
If the data is not totally static - unchanging between system restarts - we need a way to clear or reload the cached data. We went to some effort with a web UI and an API to make this work across a cluster of servers.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi