Nabil Sayegh <nsmail@sayegh.de> writes:
> However, shouldn't "LIKE '%'" be ALWAYS ignored no matter how the
> database is structured?
It's a no-op at runtime, sure, but the planner does not know enough
about LIKE to realize that (at least not in the default 7.0.* setup;
you might want to look at contrib/likeplanning).
I'm guessing that the presence of the LIKE clauses is altering the
planner's row count estimates enough to change the plan it picks.
This is only a guess, however, since you still haven't shown us the
EXPLAIN results. It's also very unclear whether or not you have done
a VACUUM ANALYZE --- without that, the planner is pretty much flying
blind.
regards, tom lane