From fb0bdff981deac05388620d5670612eb96183bba Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Tue, 8 Aug 2017 11:02:59 +0500 Subject: [PATCH] Refs #28459 -- Improved performance of ValuesIterable. --- django/db/models/query.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/db/models/query.py b/django/db/models/query.py index 11976611509..ecfb93039ba 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -102,8 +102,9 @@ class ValuesIterable(BaseIterable): # extra(select=...) cols are always at the start of the row. names = extra_names + field_names + annotation_names + indexes = range(len(names)) for row in compiler.results_iter(): - yield dict(zip(names, row)) + yield {names[i]: row[i] for i in indexes} class ValuesListIterable(BaseIterable):