Bugs item #1040526, was opened at 2004-10-05 04:51
Message generated for change (Comment added) made by garrett1020
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1040526&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: SQLObject from repository
Status: Open
Resolution: None
Priority: 5
Submitted By: Marcin Wojdyr (wojdyr)
Assigned to: Nobody/Anonymous (nobody)
Summary: too many DB selects in person.addresses case
Initial Comment:
I see the same number of queries as Robert
Marcin
http://sourceforge.net/mailarchive/message.php?msg_id=9673722
>> First about MultipleJoin: as Robert wrote in
>>
http://sourceforge.net/mailarchive/forum.php?thread_id=5435228&forum_id=30269
>>
>> person.addresses will generate n+1 queries to DB.
>
>
> I don"t think that is what happens...? It"s
certainly not intended to
> cause that many selects.
Unfortunately, it does, at least it does when using
Postgres, a fresh install of
SQLObject 0.6, Python 2.3.3, W2000 :-(
The first select is :
SELECT id FROM address WHERE person_id = ###
which returns "n" id"s
then for every id in the returned list there is :
SELECT column(s)... FROM address WHERE id = ####
i.e. n+1 queries to DB.
Robert
----------------------------------------------------------------------
Comment By: Garrett Smith (garrett1020)
Date: 2006-02-04 22:29
Message:
Logged In: YES
user_id=448609
Based on the code, this behavior appears very much by design.
I recommend turning MultipleJoin into a descriptor that
implements a standard select, which would avoid the multiple
calls to the DB.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1040526&group_id=74338
|