From f3b7c059367a4e82bbfc7e4f0d42b10975e79f0c Mon Sep 17 00:00:00 2001 From: François Freitag Date: Fri, 3 Jun 2016 15:31:21 -0700 Subject: Refs #16614 -- Made QuerySet.iterator() use server-side cursors on PostgreSQL. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Josh Smeaton for the idea of implementing server-side cursors in PostgreSQL from the iterator method, and Anssi Kääriäinen and Kevin Turner for their previous work. Also Simon Charette and Tim Graham for review. --- docs/ref/models/querysets.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'docs/ref/models') diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 3090251659..5fe783514d 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1981,15 +1981,15 @@ evaluated will force it to evaluate again, repeating the query. Also, use of ``iterator()`` causes previous ``prefetch_related()`` calls to be ignored since these two optimizations do not make sense together. -.. warning:: +Some Python database drivers still load the entire result set into memory, but +won't cache results after iterating over them. Oracle and :ref:`PostgreSQL +` use server-side cursors to stream results +from the database without loading the entire result set into memory. + +.. versionchanged:: 1.11 - Some Python database drivers like ``psycopg2`` perform caching if using - client side cursors (instantiated with ``connection.cursor()`` and what - Django's ORM uses). Using ``iterator()`` does not affect caching at the - database driver level. To disable this caching, look at `server side - cursors`_. + PostgreSQL support for server-side cursors was added. -.. _server side cursors: http://initd.org/psycopg/docs/usage.html#server-side-cursors ``latest()`` ~~~~~~~~~~~~ -- cgit v1.3