Writing good queries is the first step to reaching good performance. Without a good query, you will most likely suffer from bad performance. Writing good and intelligent code will therefore give you the greatest edge possible. Once your queries have been optimized from a logical and semantical point of view, good memory settings can provide you with a final nice speedup. In this section, you will learn what more memory can do for you and how PostgreSQL can use it for your benefit.
To demonstrate things, I have compiled a simple example:
test=# CREATE TABLE t_test (id serial, name text);
CREATE TABLE
test=# INSERT INTO t_test (name) SELECT 'hans'
FROM generate_series(1, 100000);
INSERT 0 100000
test=# INSERT INTO t_test (name) SELECT 'paul'
FROM generate_series(1, 100000);
INSERT 0 100000
1 million rows containing hans will be added to...