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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:06:43+00:00 2026-06-07T21:06:43+00:00

I have 2 mysql servers. 1 node is master and the other acting as

  • 0

I have 2 mysql servers. 1 node is master and the other acting as slave, replicating from the master

The 2 nodes have identical data and schema.
However, 1 particular query is executed differently from mysql when run on both nodes

query

EXPLAIN SELECT t.*, COUNT(h.id)
                         FROM tags t
                         INNER JOIN tags2articles s
                         ON t.id = s.tag_id
                         INNER JOIN tag_hits h
                         ON h.id = s.tag_id
                         INNER JOIN articles art
                         ON art.id = s.`article_id`
                         WHERE art.source_id IN (SELECT id FROM feeds WHERE source_id = 15074)
                         AND time_added > DATE_SUB(NOW(), INTERVAL 1 DAY)
                         AND t.type = '1'
                         GROUP BY t.id
                         HAVING COUNT(h.id) > 4
                         ORDER BY COUNT(h.id) DESC
                         LIMIT 15

Below is the outpout from EXPLAIN query run on both nodes. Note that the master node is outputting
the correct one

output on master node

+----+--------------------+-------+-----------------+-----------------------------+---------------------+---------+----------------+--------+----------------------------------------------+
| id | select_type        | table | type            | possible_keys               | key                 | key_len | ref            | rows   | Extra                                        |
+----+--------------------+-------+-----------------+-----------------------------+---------------------+---------+----------------+--------+----------------------------------------------+
|  1 | PRIMARY            | art   | ALL             | PRIMARY                     | NULL                | NULL    | NULL           | 100270 | Using where; Using temporary; Using filesort |
|  1 | PRIMARY            | s     | ref             | PRIMARY,FK_tags2articles    | FK_tags2articles    | 4       | art.id         |     12 | Using index                                  |
|  1 | PRIMARY            | h     | ref             | tags_hits_idx               | tags_hits_idx       | 4       | s.tag_id       |      1 | Using index                                  |
|  1 | PRIMARY            | t     | eq_ref          | PRIMARY,tags_type_idx       | PRIMARY             | 4       | s.tag_id       |      1 | Using where                                  |
|  2 | DEPENDENT SUBQUERY | feeds | unique_subquery | PRIMARY,f_source_id_idx     | PRIMARY             | 4       | func           |      1 | Using where                                  |
+----+--------------------+-------+-----------------+-----------------------------+---------------------+---------+----------------+--------+----------------------------------------------+

output on slave node

+—-+——————–+——-+—————–+—————————–+——————+———+——————–+——–+—————————————-

------+
| id | select_type        | table | type            | possible_keys               | key              | key_len | ref                | rows   | Extra                                        |
+----+--------------------+-------+-----------------+-----------------------------+------------------+---------+--------------------+--------+----------------------------------------------+
|  1 | PRIMARY            | t     | ref             | PRIMARY,tags_type_idx       | tags_type_idx    |  2      | const              | 206432 | Using where; Using temporary; Using filesort |
|  1 | PRIMARY            | h     | ref             | tags_hits_idx               | tags_hits_idx    | 4       | t.id               |      1 | Using index                                  |
|  1 | PRIMARY            | s     | ref             | PRIMARY,FK_tags2articles    | PRIMARY          | 4       | h.id               |      2 | Using where; Using index                     |
|  1 | PRIMARY            | art   | eq_ref          | PRIMARY                     | PRIMARY          | 4       | s.article_id       |      1 | Using where                                  |
|  2 | DEPENDENT SUBQUERY | feeds | unique_subquery | PRIMARY,f_source_id_idx     | PRIMARY          | 4       | func               |      1 | Using where                                  |
+----+--------------------+-------+-----------------+-----------------------------+------------------+---------+--------------------+--------+----------------------------------------------+

I cannot understand why this discrepancy exists. Any help?

Thanks

  • 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-07T21:06:44+00:00Added an answer on June 7, 2026 at 9:06 pm

    They can have different statistics for indexes / keys and that causes differences in index usage. If possible (locks table, so not always recommended) run ANALYZE TABLE for all participating tables and then query plan is likely same.

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

Sidebar

Related Questions

In a MySQL master-slave replication enviroment if I have 4 slave servers how can
I have two MySQL servers configured in a Master-Slave relationship. Master -> my.cnf: server-id=1283522287
I have a MySql Master server replicating to three Slaves. A legacy website is
I have the following query in MySQL SELECT *,(select lat from node where id=node_id)as
I have two MySQL servers configured in a multi-master replication setup. Each is a
I have a MySQL cluster setup, There are 2 data nodes and 1 management
I have a few servers stateside, Django + MySQL. It all works fine but
I have bulk data of 2 gb on mysql server and I want to
I have got a requirement that mysql database can only be accessed from localhost.
I have a little script here which uses DOMDocument to get my data from

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.