[Answered ]-What gives better performance: name__iexact=name or name=name.lower() in Django?

2👍

Doing name=name.lower() would perform better as you’re only doing the lowercasing once (or it would not be needed since you mention you already stored it in lowercase) and then comparing with equality in the DB

Doing name__iexact=name will be a little slower as the ORM will perform a “LIKE” instead of “=”, thus evaluating whether it matches for upper or lower case on each row.

👤Jj.

Leave a comment