Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7077919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:28:57+00:00 2026-05-28T06:28:57+00:00

I have an application where users start taking tests and sometimes the users forget

  • 0

I have an application where users start taking tests and sometimes the users forget to finish/submit their tests. The admins have requested a button that they could click which goes through the system, finds all of the unsubmitted exams, and scores them.

This process is done with a single select statement to load all of the impacted exams. Then, an in-memory process determines each user’s score. The problem is that updating the database with each user’s score is very slow. The update queries take several minutes and hundreds or thousands of update statements are run (depending on how many unsubmitted exams are waiting to be processed). My database server uses MySQL.

Is there any good way to merge these update queries into a single update? Each user receives a unique score for their exam. I’ve found a few links about how to do this, but my fellow developers tell me that these are unmaintainable and too complicated. Most of them deal with adding case statements to the update query (one for each scored exam). Here is an example of one suggestion:

http://dashasalo.com/2009/06/18/update-multiple-rows-with-different-values/

Is there any other idea that I’m missing which might improve the performance of this process? Thanks!

Note: I do have proper indices setup on this table and each individual query takes between 0.2-0.5 seconds to complete. I also suggested a night-time cron job or an automatic cleanup. The admins rejected this stating that they want to control when the cleanup process occurs and no cron/automatic/nightly process is acceptable to them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:28:58+00:00Added an answer on May 28, 2026 at 6:28 am

    When you say that the scoring is done in memory, I presume you mean that an application is selecting the test answers from the database and scoring them.

    Once the scores are determined, you could sort the results based on the score and build lists of tests for each score. Using this list, you could build some dynamic SQL to update all tests that have the same score, something like:

    UPDATE tests
    SET score = 100
    WHERE TestID IN (1,2,10,1000);
    
    UPDATE tests
    SET score = 99
    WHERE TestID IN (8,12,46,2000);
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that allows users to write their own code in a
I have a web application with users and their documents. Each user can have
We have an ASP.NET application that uses Forms Auth. When users log in, a
I have an application that allows users to upload images. The test case I
I have a filemanager application that allows users to upload files to the server
I have an application which is used by users to download some files that
I have a ClickOnce environment like this: \\Fileserver\ClickOnceApps\App1.application C:\Documents and Settings\user\Start Menu\Programs\publisher\app1.appref-ms My understanding
I have an application that starts playing a sound when user touches the uiview
We have an application where users enter prices all day. These prices are recorded
I have an application where users can upload video files of any size, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.