Current situation (changed the config-file) and stopped and started the server (is this necessary ?)
Config file :
Max_connections = 64
shared_buffers = 150
enable_seqscan = true
enable_indexscan = true
enable_tidscan = true
enable_sort = true
enable_nestloop = true
enable_mergejoin = true
enable_hashjoin = true
effective_cache_size = 1000 # default in 8k pages
random_page_cost = 4
cpu_tuple_cost = 0.0001
cpu_index_tuple_cost = 0.0000000001
cpu_operator_cost = 0.25
geqo_selection_bias = 2.0 # range 1.5-2.0
sort_mem = 512
That is all it has in it (other lines are commented out)
The same query (which is I guess a good benchmark?) still takes 13 to 14 seconds to run... Much too long ! It keeps going for the seq scan too ... (dubble checked : unique, not primary index on user_id in users and a not unique, not primary index on user_id in portfolio according to phpPgAdmin).
Maybe I would need to do some "recommended" reading, since I have only installed this database for the first time now and I am running it to lead a game with over 900 participants ... Does anybody know a good site and/or book ? However, a fast and reliable solution to improve the speed of the database would be appreciated even more!
pm=> explain select count(*) from users where user_id not in (select user_id from portfolio);
NOTICE: QUERY PLAN:
Aggregate (cost=114.26..114.26 rows=1 width=0)
-> Seq Scan on users (cost=0.00..113.01 rows=5 width=0)
SubPlan
-> Seq Scan on portfolio (cost=0.00..42.30 rows=3020 width=4)
EXPLAIN
pm=>
pm=> select count(*) from users where user_id not in (select user_id from portfolio);
count
339
(1 row)