... it more efficient or even blocking it. Use QuerySet.fetch_mode() to set the fetch mode for model instances fetched by a QuerySet : from djan ... tch all missing author fields for the batch of books …for a total of 2 queries. The batch query makes this mode a lot more efficient than FETCH_ONE and is similar to an on-demand call to QuerySet.prefetch_related() or prefetch_related_objects() . Using FE ... ... , the database may still need to scan everything to evaluate a non-unique condition. Narrowing your query up-front is more efficient. Retrieve related objects efficiently Generally, accessing the database multiple times to retrieve different parts of a si ... ngle "set" of data is less efficient than retrieving it all in one query. This is particularly important if you have a query that is executed in a loop, and co ... queries for efficiency. Use the FETCH_PEERS fetch mode Use the FETCH_PEERS fetch mode to make on-demand field access more efficient with bulk-fetching. Enable it for all usage of your models with a custom manager . Using this fetch mode is easier than de ... ... or comments. Multiple fixes for Django's support of Oracle databases, including pagination support for GIS QuerySets, more efficient slicing of results and improved introspection of existing databases. Several fixes for query support in the Django object- ... ... article_set . all () <QuerySet [<Article: Django is cool>]> # The API follows relationships as far as you need, performing efficient # JOINs for you behind the scenes. # This finds all articles by a reporter whose name starts with "John". >>> Article . ob ... ... now sets the primary key on objects when using MariaDB 10.5+. The DatabaseOperations.sql_flush() method now generates more efficient SQL on MySQL by using DELETE instead of TRUNCATE statements for tables which don't require resetting sequences. SQLite fun ... ... FAULT These options handle deletion logic entirely within the database, using the SQL ON DELETE clause. They are thus more efficient than the existing Python-level options, as Django does not need to load objects before deleting them. As a consequence, th ... ... ost (see パフォーマンス ), and without the ability to have efficient long-running requests. Many parts of Django provide asynchronous APIs, including the ORM , the cache framework, authentica ... ... ange returned a list in Python 2 and a range in Python 3. Django 1.8 consistently returned a list, but an iterator is more efficient. Existing code that depends on list specific features, such as indexing, can be ported by converting the iterator into a l ... ... ecuted, while send_mass_mail() uses a single connection for all of its messages. This makes send_mass_mail() slightly more efficient. send_mail() with multiple to addresses sends a single email message, with john@example.com and jane@example.com both appe ... th the legacy compat32 policy, are responsible for implementing their own CRLF injection prevention. Sending many messages efficiently SMTP コネクション (またはその他のネットワークコネクション) の確立とクローズは、負荷の高い処理です。 送信するメールがたく ... d as a context manager, which will automatically call open() and close() as needed. An example is in Sending many messages efficiently . 開発用にメールを設定する Django に電子メールをまったく送信させたくない場合もあるでしょう。たとえば、ウェブサイトの開発 ... ... update referring objects, whilst the other values make Django perform the relevant actions. The database variants are more efficient because they avoid fetching related objects, but pre_delete and post_delete signals won't be sent when DB_CASCADE is used. ... 2026年10月08日