Finally, I found the real reason of performance problem. There is a pickle filed in my table. SQLAlchemy update all rows every query. That's why it is so slow. By following the guide of FAQ, I have solved that problem.
Thanks your help. Victor Lin. On 8月19日, 上午1時16分, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Aug 18, 2008, at 1:02 PM, Victor Lin wrote: > > > > > I found that it seems not the transaction cause the performance > > problem. > > I think it maybe cause by use one session for a long time. > > Performance getting slower with the program run longer time. > > Once I stop the program and run it again, at first it works fast. > > > So I think it is the problem of using a session for too many query and > > insert? > > I think the identify map or something else getting bigger and bigger > > with time. > > > Is that correct? How to solve this problem? > > Assuming youre on at least version 0.4 with the default settings, the > Session only holds onto objects that are referenced elsewhere in your > application. If your app needs to hold many objects in memory but > you dont want them all being maintained within the Session, remove > them using Session.expunge(someobject) or everything using > Session.expunge_all() (which used to be called Session.clear()). The > flush() process in particular may be scanning the whole collection of > objects. > > The 0.5 session has some enhancements such that a flush() usually does > not scan the entire Session's contents. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---