Comment 2 for bug 4819

Revision history for this message
James Henstridge (jamesh) wrote :

The extra COUNT(*) is because of an allocation optimisation when converting an iterable to a list: if the iterable provides a __len__() method, it is called first. That many items are allocated in the new list and then filled by iterating over the list.

For SQLObject, this optimisation hurts performance overall. The additional query could be avoided if SelectResults.__len__() was removed (but that might cause other problems).