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 7048051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:50:42+00:00 2026-05-28T02:50:42+00:00

I have a log table that gets processed every night. Processing will be done

  • 0

I have a log table that gets processed every night. Processing will be done on data that was logged yesterday. Once the processing is complete I want to delete the data for that day. At the same time, I have new data coming into the table for the current day. I partitioned the table based on day of week. My hope was that I could delete data and insert data at the same time without contention. There could be as many as 3 million rows of data a day being processed. I have searched for information but haven’t found anything to confirm my assumption.
I don’t want to have the hassles of writing a job that adds partitions and drop partitions as I have seen in other examples. I was hoping to implement a solution using seven partions. eg.

    CREATE TABLE `professional_scoring_log` (
      `professional_id` int(11) NOT NULL,
      `score_date` date NOT NULL,
      `scoring_category_attribute_id` int(11) NOT NULL,
      `displayable_score` decimal(7,3) NOT NULL,
      `created_at` datetime NOT NULL,
      PRIMARY KEY (`professional_id`,`score_date`,`scoring_category_attribute_id`),
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8
    /*!50100 PARTITION BY RANGE (DAYOFWEEK(`score_date`))
    (PARTITION Sun VALUES LESS THAN (2) ENGINE = InnoDB,
     PARTITION Mon VALUES LESS THAN (3) ENGINE = InnoDB,
     PARTITION Tue VALUES LESS THAN (4) ENGINE = InnoDB,
     PARTITION Wed VALUES LESS THAN (5) ENGINE = InnoDB,
     PARTITION Thu VALUES LESS THAN (6) ENGINE = InnoDB,
     PARTITION Fri VALUES LESS THAN (7) ENGINE = InnoDB,
     PARTITION Sat VALUES LESS THAN (8) ENGINE = InnoDB) */

When my job that processes yesterday’s data is complete, it would delete all records where score_date = current_date-1. At any one time, I am likely only going to have data in one or two partitions, depending on time of day.

Are there any holes in my assumptions?

  • 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-28T02:50:43+00:00Added an answer on May 28, 2026 at 2:50 am

    Charlie, I don’t see any holes in your logic/assumptions.

    I guess my one comment would be why not use the drop/add partition syntax? It has to be more efficient than DELETE FROM .. Where ..; and it’s just two calls – no big deal — store “prototype” statements and substitute for “Sun” and “2” as required for each day of the week — I often use sprintf for doing just that

    ALTER TABLE `professional_scoring_log` DROP PARTITION Sun;
    
    
    ALTER TABLE `professional_scoring_log` ADD PARTITION (
        PARTITION Sun VALUES LESS THAN (2)
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a log table that will receive inserts from several web apps. I
I have a table that contains log entries for a program I'm writing. I'm
I have a table that functions as an event log and stores the users
I have this big function that gets a lot of different data and insert
We have a log table that has a message column that sometimes has an
I have a Manager class that saves data in the SQL table and also
I have a log table with the following format (and sample data): date |
I've got a scenario where I have a database with one table that gets
I have a log that is really huge. (millions of rows) LogTable ------- ID
I have an Oracle table which contains event log messages for an application. We

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.