Performance of UNION vs IN - Mailing list pgsql-performance

From Jean-Max Reymond
Subject Performance of UNION vs IN
Date
Msg-id 532B1E05.70409@free.fr
Whole thread Raw
Responses Re: Performance of UNION vs IN  (Torsten Förtsch <torsten.foertsch@gmx.net>)
List pgsql-performance
I have a very complex view zinfoexp and running the view as:
SELECT * FROM zinfoexp  WHERE idmembre in (1,84)
take 2700 ms

So, I try another syntax:
SELECT * FROM zinfoexp  WHERE idmembre = 1
union
SELECT * FROM zinfoexp  WHERE idmembre = 84

and for me, two calls to my view takes a lot of time (may be x2) and it
takes 134 ms !

How is it possible that the optimizer cannot optimize the IN as UNION ?
I have a database postgresql 9.3  freshly vacuumed

--
Jean-Max Reymond
CKR Solutions Open Source http://www.ckr-solutions.com


pgsql-performance by date:

Previous
From: Stefan Keller
Date:
Subject: Getting query plan alternatives from query planner?
Next
From: Tom Lane
Date:
Subject: Re: Getting query plan alternatives from query planner?