Duplicate WHERE condition changes performance and plan

2020-04-15 Thread singh...@gmail.com
Hi, We have an odd issue where specifying the same where clause twice causes PG to pick a much more efficent plan. We would like to know why. Query A (this is the 'slow' query): UPDATE problem_instance SET processed = false FROM problem WHERE problem.id = problem_instance.problem_id AND problem.s

Using unlogged tables for web sessions

2020-04-15 Thread Stephen Carboni
Hi. Apologies in advance if this is not the right place to ask. I was wondering if anyone was using unlogged tables for website sessions in production. I'm interested if UNLOGGED breaks the prevailing opinion that you don't put sessions in PG.

Re: Duplicate WHERE condition changes performance and plan

2020-04-15 Thread David Rowley
On Thu, 16 Apr 2020 at 07:56, singh...@gmail.com wrote: > We have an odd issue where specifying the same where clause twice causes PG > to pick a much more efficent plan. We would like to know why. > The EXPLAIN ANALYZE for both queries can be found here:- > Query A: https://explain.depesz.com/s