I have a few tables that I use for temporary functions, and they can get very big - like 2.6 million records in my latest project. I need to delete these all the time, and it is very slow. It almost takes longer than filling them!
I am currently setting up a UniQuery and running SQL like 'DELETE FROM TEMPTABLE'.
Is there a faster way to do it? I am thinking of Dropping the table and then recreating it again. But before I do that, are there any functions in UniDac that might help? The Batch delete option does not seem much use as I simply want to delete everything and I don't have a primary key that I know the value of to setup any parameters with.
Fastest way to delete all records?
-
- Posts: 77
- Joined: Wed 08 Oct 2008 04:55
Re: Fastest way to delete all records?
Never mind - I found that I can use the UniTable and then EmptyTable. That is very fast. Seems the best way when I want to delete everything.
Re: Fastest way to delete all records?
I do not know code written for EmptyTable. But, SQL command "truncate" should be the fastest method among different database systems as to my knowledge.
Re: Fastest way to delete all records?
The described functionality depends on the used DB and does not depend on access components behavior, which you are using. When using the EmptyTable method, UniDAC automatically composes a query as follows DELETE FROM ... or TRUNCATE ... depending on the used provider