When Using CharField in Django Admin list_filter, Adding Choices Makes It Faster

2021-03-30 21:05 (3 years ago) ytyng

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.

Currently unrated

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011