Description of problem: Postgresql allows for 'ilike' which is case-insensitive like. However, 'ilike' cannot use indexes, resulting in slow queries. There are a couple of ways to go about fixing this but one way would be to call lower() on both sides of the comparisons, which would let us use LIKE. There is some discussion in http://grokbase.com/t/postgresql/pgsql-hackers/12cwwmjgs9/ilike-vs-indices about the pros and cons of this (mostly related to locale concerns), but I think for the types of data Katello works with, I think a "lowercase everything when searching" approach is OK. NOTE: this bz is for a SQL optimization to make searches faster, for example when searching for an erratum. Ideally, it should have no functionality impact. Version-Release number of selected component (if applicable): 6.2.0 beta
Upstream bug assigned to zhunting
The ILIKE operator comes from scoped search (https://github.com/wvanbergen/scoped_search/blob/c874ab5de817a6d619baaa1d07129b5743a98708/lib/scoped_search/query_builder.rb#L536), so I doubt we want to customize this part easily. If there is a place where LIKE queries are very common, we can explore the option of text indices: https://blog.2ndquadrant.com/text-search-strategies-in-postgresql/. Before we go there, IMHO we should prove negative impact on the user, since it adds more complexity to DB structure.
Ya agreed, I think its OK to close this bug out. It was found when investigating another issue, but https://bugzilla.redhat.com/show_bug.cgi?id=1330306 already reduced the time by 1/2 without making any changes to scoped search.
Closing for now, as it seems like a premature optimization from the last comment. Thanks, Chris!