The use and abuse of memory is one of the first things to consider in database tuning, as this is the fastest storage resource that you have (aside from CPU registers).
Any time data can be read from memory, rather than from disk, performance is quite likely to improve by a factor of a thousand or more.
Maximize data in memory
As a rule of thumb, for databases, the more RAM you have that can be used to cache results, the better performance will be, as this allows queries to avoid needing to consult disk over and over again.
There are numerous PostgreSQL parameters for controlling the use of memory to cache various sorts of "information of interest"...