Re: slooow delete

Sebastien Bigaret <[email protected]> 10 Mar 2005 15:10:59 +0100
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
John Lenton <[email protected]> wrote:
> On 05 Mar 2005 16:31:38 +0100, Sebastien Bigaret
> <[email protected]> wrote:
> >=20
> > Even better, if you can, change ec.delete/ec.saveChange into:
> >=20
> >   ec.delete(obj)
> >   print ec.currentStateSummary() # print it or log it if this is a web =
app
> >   ec.processRecentChanges()
> >   print ec.currentStateSummary()
> >   ec.saveChanges()
> >   print ec.currentStateSummary()
>=20
> instead of the print I did
>=20
>     print >> sys.stderr, '***', pprint.pformat(ec.currentStateSummary())
>=20
> and here is the output:
>=20
> *** {'auto_insertion': 0,
>  'deleted': 0,
>  'inserted': 0,
>  'nb_objects': 2311,
>  'pending_deleted': 1,
>  'pending_inserted': 0,
>  'pending_updated': 2,
>  'time': 1110383332.976902,
>  'updated': 0}
> *** {'auto_insertion': 0,
>  'deleted': 1,
>  'inserted': 0,
>  'nb_objects': 21184,
>  'pending_deleted': 0,
>  'pending_inserted': 0,
>  'pending_updated': 0,
>  'time': 1110383439.4831209,
>  'updated': 3}
> *** {'auto_insertion': 0,
>  'deleted': 0,
>  'inserted': 0,
>  'nb_objects': 21183,
>  'pending_deleted': 0,
>  'pending_inserted': 0,
>  'pending_updated': 0,
>  'time': 1110383446.224946,
>  'updated': 0}


Bad news, most of the time is eaten by processRecentChanges()... which
fetches 18873 objects and modifies 3 of them.

  I can't see where it can occur except in EntityClassDexcription's
  propagateDeleteForObject().  Can you be a little more explicit about
  the model (maybe w/ names like A, B and Cs if you cannot disclose the
  real names), and esp. the relationship between the deleted object's
  entity and other entities?

As far as I can see, the propagation of the deletion implies the
modification of 3 objects, so the relationship linking these objects to
the deleted object must be a DELETE_NULLIFY one; now I'd like to know
more about the type of the relationships (toone/tomany).  In particular,
I'd like to understand why so many objects are fetched (is there, by any
chance, a to-many relationships without an inverse relationship defined
pointing back to the object?)


-- S=E9bastien.



NB: In case it might help: you can quickly see how many objects of which
    type are in the ec w/ something like::

      d=3D{} # { "entity name": nb_of_objects }
      for gID in ec._uniquingTable.globalIDs():
        d[gID.entityName()] =3D d.setdefault(gID.entityName(), 0) + 1



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click