Why is PostgreSQL very slow when I execute a SELECT query with OR in WHERE clause?
This is a common issue - PostgreSQL planner cannot use indexes (it's not able to optimize OR, when OR is used for subselects) and rewriting with UNION helps. Last year Tom Lane wrote a patch, but as far as I know, this patch was not merged yet.