|
Don't use len() on QuerySets |
|
|
|
|
Written by Gordon Tillman
|
|
Thursday, 04 December 2008 17:43 |
|
From the Django docs:
Note: Don't use len() on QuerySets if all you want to do is determine the number of records in the set. It's much more efficient to handle a count at the database level, using SQL's SELECT COUNT(*), and Django provides a count() method for precisely this reason.
|
|
Last Updated on Thursday, 04 December 2008 18:37 |