Simple DELETE takes over 12 minutes

mahmed1

Well-known Member
Joined
Mar 28, 2009
Messages
2,302
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi All

I am trying to delete all data from a table which is taking over 12 minutes each time (i do have over 500k records) to delete

DELETE * FROM tblRollingData thats my query but it takes forever to run (Can you please help me speed this up)

i also have another DELETE in another table but this takes long but not as long

DELETE * from tbl_tempData WHERE Date_ is not NULL

Please Please help me speed this UP

thank You
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Some questions:

  • Have you compacted the database recently
  • Is the table related to other tables or other software like SQL
  • Would it be easier to just delete the whole table
  • Access VBA might help. In a module create a sub routine and add this code: CurrentDb.Execute “DELETE * FROM tblRollingData”
 
Upvote 0
Hi this table is a temp table that is used to import data into - i then delete out rows that are blank and insert into another table

Nothing else is related
Via VBA - i run this command - DoCmd.RunSQL "DELETE * FROM tblRolling"

Ive read to Drop and recreate - is that the better option?
 
Upvote 0
If I am reading this correct, you are appending data into another table before emptying this table.

Can you not delete the empty rows before they are imported from another app?

It is easier to delete the whole object.
 
Upvote 0
Do you have a Primary Key field set in your tbl_tempData table?
I believe that might possibly help speed things along.
If you do not already have one set, you can try it and see if that helps any.
 
Upvote 0
Hiya - no i dont have any primary keys set at the mo - i dont have a unique identifier
 
Upvote 0
Hiya - no i dont have any primary keys set at the mo - i dont have a unique identifier
Just add an Autonumber field at the end of your table, and see if that makes any difference.
Sometimes table performance is better if there is a Primary Key field or Indexed field.
 
Upvote 0
Would i need to add to end of the table where it pastes too?
 
Upvote 0
Hiya - just realised that i do have an autonumber and primary key on the ID column
 
Upvote 0
Hiya - just realised that i do have an autonumber and primary key on the ID column
OK, well I was hoping maybe that would help, but obviously not.
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,619
Members
449,238
Latest member
wcbyers

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top