Opened 6 hours ago

Last modified 3 hours ago

#36690 new Uncategorized

Use case for EXTRA()

Reported by: Gareth Leake Owned by:
Component: Uncategorized Version: 5.2
Severity: Normal Keywords: QuerySet.extra
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django's ORM leverages UPPER() and casts to text UPPER(...)::text when doing a case insensitive search. This is not adequately performant for our use case, and loses the use of an index due to the UPPER() call. The extra() function allows me to explicitly make a case insensitive ILIKE call on postgres.

Change History (1)

comment:1 by ontowhee, 3 hours ago

Keywords: QuerySet.extra added

I found ticket #3575, which reported that using ILIKE in postgres is inefficient, and the solution changed the SQL from using ILIKE to UPPER. Since extra() is planned for deprecation, could the query be achieved by implementing a Func for ILIKE instead?

Note: See TracTickets for help on using tickets.
Back to Top