In an application that is heavy on inserts and updates, cProfile output is dominated by Session.add in which about 45% of time is spent. Most of that time, in turn, is spent in cascade_iterator (43%). I can provide more detailed information if needed.
The application does aggressive caching of data and has set expire_on_commit=False, in order to keep database load down. Is that the reason for Session.add slowness? Is there a way I can speed this up while keeping a similar level of cache aggressiveness? For example, in one test run Session.__contains__ was invoked 25m times over the course of only a few minutes, accounting for 27% of total time spent. Could it be a good idea to try and override this function with one that's optimized for this specific use case? Also, so far I haven't spent any effort expunging objects from the session as soon as possible. Some objects might linger for longer than necessary. Would they contribute to Session.add's overhead? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. 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.
