Performance of UNION vs IN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance




[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux