>What are effective_cache_size and work_mem set to? The defaults?
Yes.
>They are good candidates to be increased. effective_cache_size could be set to (for example) 10GB, depending on >how much memory gets consumed by the other application(s) running on that server.
There are 10 human users and one web service user. Windows Task Manager cached value shows 10 GB
in evening when nobody is working in server.
I changed those to
effective_cache_size= 10GB
work_mem = 400MB
Hope that this is OK.
>The EXPLAIN ANALYZE plan of your query will show if work_mem needs to be increased, as there will be a line saying >something like "External merge: disk sort" (or something like that, can't recall the exact message off the top of my >head).
After adding indexes log contains
LOG: duration: 11045.000 ms statement: create index on tempkaive(toode);create index on tempalgsemu(toode);SELECT * FROM toode o WHERE exists (SELECT toode FROM tempkaive i where o.toode=i.toode) OR EXISTS (SELECT toode FROM tempalgsemu i WHERE o.toode = i.toode)
In development computer from where explain was posted and problem with copy of database also occurs: