This is a migrated thread and some comments may be shown as answers.

Open Access Delete Statement Extremely Slow.

1 Answer 61 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jeff
Top achievements
Rank 1
Jeff asked on 08 Mar 2014, 10:20 PM
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

1 Answer, 1 is accepted

Sort by
0
Ralph Waldenmaier
Telerik team
answered on 10 Mar 2014, 09:33 AM

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.

Tags
Getting Started
Asked by
Jeff
Top achievements
Rank 1
Answers by
Ralph Waldenmaier
Telerik team
Share this question
or