Hi
Actually, for all tags added to an object, a "create_or_update" is done
before really added it to the object.
I tried this : get all these tags from the DB, and for each one wanted, if
it's already in DB, directly add it for the object, and if not, create it
and then add it for the object.
If you have 5 tags, and 3 already in DB, today you do
select tag1 -> exists
select tag2 -> not exists -> insert tag2
select tag3 -> exists
select tag4 -> exists
select tag5 -> not exists -> insert tag2
=> 7 queries
With my patch :
select from tagging_tag where name in (tag 1, tag2, tag3, tag4, tag5)
-> get (tag1, tag3, tag4)
insert tag2
insert tag3
=> 3 queries
You can find my path attached
(and perhaps one day we'll can do multiple insert in one query.... hope so...)
Regards, Twidi (S. Angel)
Original issue reported on code.google.com by stephane.angel on 14 Jan 2009 at 1:16
Original issue reported on code.google.com by
stephane.angel
on 14 Jan 2009 at 1:16Attachments: