Open Access Delete Statement Extremely Slow.

2 posts, 0 answers
  1. Jeff
    Jeff avatar
    5 posts
    Member since:
    Nov 2011

    Posted 08 Mar 2014 Link to this post

    Hi. I have some code the deletes data from the database using OpenAccessContext.Delete(obj). I have come across an issue where deleting data from one of my tables (pretty large row count) is taking an extremely long time.
    When I debug, It pauses for upwards of a minute on the code:

    DatabaseContext.Delete(job.ModifierData)

    I have several other lists that are being deleted successfully this way in the same scope, but this one, and deleting the job object itself seems to be extremely slow.  I was wondering if there was a way to find out why it's slow. Thank you so much for your time
  2. Ralph Waldenmaier
    Admin
    Ralph Waldenmaier avatar
    202 posts

    Posted 10 Mar 2014 Link to this post

    Hi Jeff,

    When using the context delete approach as shown, we are loading the data of the object first and are then generating the respective delete statements for the server. 

    Depending on the amount of data this could take some time. In order to dig deeper here, you can enable logging to see which operations are performed against your database.

    In order to improve the deletion of objects I would like to recommend the bulk delete API as described here. By using this approach, you are no longer loading the objects first but the delete operation are pushed directly to the server.



    Hope this helps.

    Do come back in case you have any other question.



    Regards,

    Ralph Waldenmaier
    Telerik
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.

  3. DevCraft banner
Back to Top