---
slug: "django-admin-で-charfield-を-list_filter-に指定する場合choices-をつけると早い"
title: "When Using CharField in Django Admin list_filter, Adding Choices Makes It Faster"
description: "Why specifying `choices` on a Django `CharField` makes `list_filter` faster — it bypasses the DISTINCT query the admin runs to enumerate filter values."
url: "https://www.ytyng.com/en/blog/django-admin-で-charfield-を-list_filter-に指定する場合choices-をつけると早い"
publish_date: "2021-03-30T12:05:09Z"
created: "2021-03-30T12:05:09Z"
updated: "2026-05-11T13:09:00.357Z"
categories: []
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/4f04d5e47d58428aa45191f0a0ac5d4a.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

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

<p>When specifying a CharField in list_filter in Django Admin,</p>
<p>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.</p>
<p>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.</p>
