Results 1 to 2 of 2
  1. #1
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568

    Delete query working very slow

    Hi Guys,

    i have a delete query wtih this code:

    Code:
    DELETE tbl_Employees_SAP.*FROM tbl_Employees_SAP
    WHERE (((tbl_Employees_SAP.SAP_Nr) Not In (SELECT tbl_temp_SAP_pr.SAP_Nr FROM tbl_temp_SAP_pr)));
    both these tables have about 25 000 thousends records.
    These query is working very very slow i do not why.
    If i do this operationas on my smaller tables - it is working like a charm...

    why ?

    Best Wishes,
    Jacek Antek

  2. #2
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Okey,

    If have change a little my SQL code into:

    Code:
    DELETE *FROM tbl_Employees_SAP
    WHERE SAP_Nr  in (Select SAP_Nr From QryDeleteSAPFirst);
    where QryDeleteSAPFirst is a separated query :

    Code:
    SELECT tbl_Employees_SAP.SAP_NrFROM tbl_Employees_SAP LEFT JOIN tbl_temp_SAP_pr ON tbl_Employees_SAP.SAP_Nr = tbl_temp_SAP_pr.SAP_Nr
    WHERE (((tbl_temp_SAP_pr.SAP_Nr) Is Null));
    Now the query run very fast - 1 second and all not necessay rows are deleted...

    Best Wishes,
    Jacek

Please reply to this thread with any new information or opinions.

Similar Threads

  1. On Delete Event Not Working
    By pdowg881 in forum Access
    Replies: 2
    Last Post: 05-21-2015, 11:18 AM
  2. Replies: 1
    Last Post: 01-16-2013, 10:58 AM
  3. Replies: 4
    Last Post: 08-14-2012, 11:56 AM
  4. Delete SQL statement not working properly
    By Alexandre Cote in forum Programming
    Replies: 3
    Last Post: 10-18-2010, 12:56 PM
  5. Replies: 0
    Last Post: 04-08-2010, 12:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums