[PERFORM] Slow query: Postgres chooses nested loop over hash join, whery by hash join is much faster, wrong number of rows estimated

2015-06-11 Thread Sasa Vilic
Hi, I have a query that takes ridiculously long to complete (over 500ms) but if I disable nested loop it does it really fast (24.5ms) Here are links for * first request (everything enabled): http://explain.depesz.com/s/Q1M * second request (nested loop disabled): http://explain.depesz.com/s/9Z

Re: [PERFORM] How to reduce writing on disk ? (90 gb on pgsql_tmp)

2015-06-11 Thread Claudio Freire
On Thu, Jun 11, 2015 at 5:56 AM, ben.play wrote: > A question : is it possible with Postgres to change the temp_tablespace only > for a session (or page) ? > I have a cron which takes a lot of memory. I would like to say to PostGreSql > to use this temp_tablespace only on this command and not aff

Re: [PERFORM] How to reduce writing on disk ? (90 gb on pgsql_tmp)

2015-06-11 Thread ben.play
Of course ! I'm an idiot ... Thank you a lot ! A question : is it possible with Postgres to change the temp_tablespace only for a session (or page) ? I have a cron which takes a lot of memory. I would like to say to PostGreSql to use this temp_tablespace only on this command and not affect my u