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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:31:27+00:00 2026-06-06T06:31:27+00:00

I have a MySQL/Slave Setup everyday we are executing queries on slave machine for

  • 0

I have a MySQL/Slave Setup everyday we are executing queries on slave machine for auditing . Tables on that DB has more than 50 million rows . If I a execute those queries on slave , slave is running behind the master . On this time If a Insert query executes in Master DB . This insert queries executes multiple times on slave DB . Example Scenario : Each time a user will signin we insert their details for auditing . Look at the below data it will be inserted multiple times on the table . No way a user to signin multiple times on same second . Why it happens and how can i solve this ?

| Kannan | 2012-04-28 12:27:57           | 
| Kannan | 2012-04-28 12:27:57           | 
| Kannan | 2012-04-28 12:27:57           | 
| Kannan | 2012-04-28 12:27:57           | 
| Kannan | 2012-04-28 12:27:57   
  • 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-06-06T06:31:29+00:00Added an answer on June 6, 2026 at 6:31 am

    If you need real time data, you really need to select from the master. Insert/Selects are usually not a good idea in a master/slave environment. If you are using statement based replication, the SELECT needs to run on the slave also. If the SELECT takes 10 seconds to run, your slave is going to be behind by 10 seconds.

    Inserts are often very, very fast. The SELECT slows down the INSERT considerably because of the prep time required. For the most part, MySQL replicates 1 statement at a time. Until that statement is finished, replicating to the slave is going to fall behind.

    While counterintuitive, it’s often better to SELECT the data, create the INSERT statement (i.e. in the application layer), then run the INSERT.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web-app that has a master mysql db and four slave dbs.
I have a very straight forward master/slave replication setup with MySQL. ActiveRecord is configured
We have a Rails application that is running in a MySQL master-slave set-up for
I have never used a master/slave setup for my mysql databases so please forgive
I have MySQL InnoDB table utf-8 encoded. This table has only id and name
I have MySQL running such that I can open a client command line and
I'm setting up MySQL replication via binlog. It's a master / slave setup. I
In a MySQL master-slave replication enviroment if I have 4 slave servers how can
I have the following setup. Spring 3.0.5 Hibernate 3.5.6 MySql 5.1 To save a
I have set up replication for MySQL server. I can connect from the slave

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.