Performance of UNION vs IN

От: Jean-Max Reymond
Тема: Performance of UNION vs IN
Дата: ,
Msg-id: 532B1E05.70409@free.fr
(см: обсуждение, исходный текст)
Ответы: Re: Performance of UNION vs IN  (Torsten Förtsch)
Список: 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 по дате сообщения:

От: Torsten Förtsch
Дата:
Сообщение: Re: Performance of UNION vs IN
От: Stefan Amshey
Дата:
Сообщение: slow join not using index properly