0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Django Adminにてレスポンスが遅い場合に確認すること

Last updated at Posted at 2025-02-20

原因

該当のテーブルが外部キーを設定していた。
これによって出力時に1件ずつ抽出していたため、レスポンスが遅くなっていた。
この場合は、list_select_relatedを設定する必要がある。

admin.py
list_select_related = ("cilent_id",)

まとめ

大量のデータ表示でないと、意外と気づかないかもしれない。ログを注視すれば何度もSELECTしていることが確認できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?