Results 1 to 6 of 6
  1. #1
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47

    Coded Loop v SQL Update Query Performance


    Can anyone tell me the relative performance of updating a single field in 20 column table using coded loops versus a SQL update query on say a table containing 50,000 rows?

    Appreciate any assistance.

    Tnx
    bginhb

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It would be simple enough to test but I'd bet on the SQL to out perform the loop. I'm on an iPad or I'd test it now.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47
    I built the code and ran the two alternatives finding that the SQL approach not only was faster but at least 6 times faster. Now I'm trying to get an actual multiple since the SQL approach took 1 second or less to run I want to get the difference between the two running times in milliseconds but Access seems reluctant to provide it.

    How can I get the difference between 2 dates/times to display as milliseconds?

    Appreciate any assistance.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    THere is a link for milliseconds in Access

    http://www.devx.com/dbzone/Article/39046

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't have a db in front of me but I think the Timer function can be used as well.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    bginhb is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    Huntington Beach, CA, USA
    Posts
    47

    Getting Milliseconds

    I found the easiest way was to capture the start and end times using now() in Date variables, then save their values into Double variables. Find the difference and multiply by the number of seconds in a day:
    (Late Time - EarlyTime) * 86400 and presto you have seconds to 15 decimals.

    Thank you all for your input!

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

Similar Threads

  1. Query Performance
    By GBa in forum Queries
    Replies: 3
    Last Post: 01-03-2012, 03:33 PM
  2. Addition of similar coded items in query
    By shanky365 in forum Queries
    Replies: 1
    Last Post: 08-23-2011, 11:50 PM
  3. Query performance on different computer
    By nickevans1979 in forum Queries
    Replies: 2
    Last Post: 07-26-2011, 03:16 PM
  4. Update Query Performance Issue
    By Amber_1977 in forum Queries
    Replies: 2
    Last Post: 12-07-2010, 08:36 AM
  5. update table in loop based on IF statement
    By LALouw in forum Access
    Replies: 0
    Last Post: 07-26-2009, 08:46 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