Hi Pavel, That is what I've done in this particular case but there are parts where I use exist checks in this way that are very cumbersome to write out like that so I'm hoping there is a way to make the optimizer work with existence checks in this way. Cheers, Bastiaan Olij On 19/02/13 6:39 PM, Pavel Stehule wrote: > 2013/2/19 Bastiaan Olij <bastiaan@xxxxxxxxxxxx>: >> Hi Andy, >> >> I've tried that with the same result. One subquery works beautifully, >> two subqueries with an OR and it starts to do a sequential scan... > try to rewrite OR to two SELECTs joined by UNION ALL > > Pavel > -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance