Haki Benita
1 min readFeb 17, 2019

--

Actually, unless you plan on reusing the result set, Count is almost always better. Using Count Django will issue a select count(*) query. Using len Django will evaluate the queryset (fetching all rows into memory) and get the length of the list.

Also, in the admin, the queryset is pages so fetching len will just get you the length of the first page.

--

--

Haki Benita
Haki Benita

Written by Haki Benita

Full Stack Developer, Team Leader, Independent. More from me at https://hakibenita.com

No responses yet