When Using CharField in Django Admin list_filter, Adding Choices Makes It Faster
2021-03-30 12:05 (5 years ago)

When specifying a CharField in list_filter in Django Admin,
if choices are not specified for that CharField, it fetches all existing values of all records using DISTINCT, which can be quite slow without an index.
In such cases, if it is possible to specify choices, doing so will eliminate the need for SQL queries and significantly speed up the process.
Please rate this article (No signup or login required)
Currently unrated
Related posts
Exclude Users with is_active = False in Django Admin (Replacing the User Admin)
Creating Custom Filters in Django Admin
You should avoid using MySQL collation utf8_unicode_ci as it can be quite slow
Here's the English translation of your blog title:"A Story About Trying to JOIN Fields with Different Collations in MySQL and Getting 'Range checked for each record'"
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.
We look forward to discussing your development needs.