I have a transaction that uses save_or_update() and takes 2-3 minutes
to execute:

There's some setup before the transaction (pseudocode for brevity)

contact = Contact()
# ...set props on contact

contact.user = User()
# ...set props on user


trans = None
        try:
            trans = session.create_transaction()
            # Save the contact
            session.save_or_update(contact)
            session.flush()

            invoice = Invoice()
            invoice.contact = contact
            # ...set other props on invoice

            session.save_or_update(invoice)
            session.flush()

            session.save_or_update(invoice)
            session.flush()

            trans.commit()

        except:
            if trans != None:
                trans.rollback()
            raise


The save_or_update() on contact takes several minutes! I have MySQL
(using version 1.2.2 of MySQLdb python DBAPI)  db with approx
20,000-30,0000 contact and user records in each table.  If I run an
insert manually on the contact and user tables there's no noticeable
overhead.

Any clues where I should look to see what's causing the apparent
momentary deadlock. (I did try echo_uow w/ the session and it does
show a lot of misc nodes that have a relation to contact in the
tree...but none of them have an instance instance in the session that
needs to be saved/updated.)

Perhaps I need to use SQL api to execute the statements without going
through ORM. But I was hoping that SQLAlchemy would be a bit more
scalable. (When I run this action on db without many records it takes
less than a second to execute, but as db grows in size the performance
degrades.)


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to