Oracle, SQL Serverand MySQLwill generate the same plans for both queries.
If the field of interest is not indexed, this is a simple filter.
If the field is indexed and index search is selected by the optimizer:
Oracle uses INLIST ITERATORSQL Server uses CONSTANT SCANMySQL uses access method range
PostgreSQLgenerates nominally different plans: ORwith two index conditions in the first case and one index condition ANY(123, 1245):INTEGER[]in the second case.
, , .
, , .
:
SELECT *
FROM mytable
WHERE id = 123
AND …
UNION ALL
SELECT *
FROM mytable
WHERE id = 1245
AND …
( ) , ( ) .