def get_total_count(self):
        """
        Calling `len()` on a QuerySet would execute the whole SELECT.
        See `/blog/2012/0124`
        """
        di = self.data_iterator
        if isinstance(di, QuerySet):
            return di.count()
        #~ if di is None:
            #~ raise Exception("data_iterator is None: %s" % self)
        if False:
            return len(di)
        else:
            try:
                return len(di)
            except __HOLE__:
                raise TypeError("{0} has no length".format(di))
dataset/ETHPy150Open lsaffre/lino/lino/core/tablerequest.py/TableRequest.get_total_count