SQLite User Forum

bad plan for a query with an OR condition
Login
Those are not equivalent queries.  Here is an example:

> ~~~
CREATE TABLE t(x INT,c1 INT,c2 INT);
INSERT INTO t VALUES
  (1,0,0),
  (2,1,0),
  (3,0,1),
  (4,1,1);
SELECT x FROM t WHERE c1 OR c2;
SELECT x fROM t WHERE c1
  UNION ALL SELECT x FROM t WHERE c2;
~~~

Copy/paste the above in the CLI (or into PostgreSQL if you doubt that
SQLite is doing it correctly) and see that the second query provides 4
rows of output whereas the first query provides only 3.