SQLObject executing spurious COUNT(*) using slices
Bug #4818 reported by
Stuart Bishop
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
Medium
|
James Henstridge |
Bug Description
>>> r = Person.
>>> len(r[:5])
At this point, the following query is executed:
SELECT COUNT(*) FROM Person WHERE 1 = 1
This is causing us timeout errors
>>> list(r[:5])
This causes the following two queries to be executed:
SELECT Person.* FROM Person WHERE 1 = 1 ORDER BY id LIMIT 5
SELECT COUNT(*) FROM Person WHERE 1 = 1
In the case of PersonSet.
Changed in launchpad: | |
status: | New → Accepted |
To post a comment you must log in.
Assigning to spiv - I need a guess on how fixable this is. If it is going to be difficult or time consuming, we can work around this particular case and others as we track them down.