id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux
3575 postgres backend should optimize iexact searches Jack Moffitt Jacob "Currently queries using {{{field__iexact=""blah""}}} translate to {{{field ILIKE 'blah'}}}. This is really inefficient because ILIKE queries (since they are for pattern matching) cannot be indexed and the whole table must be scanned. If {{{LOWER(field) = LOWER('blah')}}} is used, it accomplishes the same thing, but an index can be created for LOWER(field) that eliminates the table scan.
This is a little tricky since the default substitution is only on the operator and the right operand, but this patch adds a column substitution array as well. This patch should probably be applied across all backends where LOWER() is supported. Currently it only changes the postgresql_psycopg2 backend." Cleanup/optimization closed Database layer (models, ORM) master Normal fixed metajack@… tofu@… sam@… Accepted 1 0 1 1 0 0