I am working for a company which have huge traffic on their website. They have huge Database and using MySQL Replication.
REPLICATION MYSQL SERVER A
REPLICATION MYSQL SERVER B
REPLICATION MYSQL SERVER C ----> WEBSITE <—> MASTER MYSQL SERVER
REPLICATION MYSQL SERVER D
REPLICATION MYSQL SERVER E
Now, ALL SELECT’s statements executed from SERVER A,B,C,D,E and ALL INSERT,DELETE,UPDATE,CREATE,DROP’s statements executed from MASTER MYSQL SERVER.
The problem is there will be very high load on SERVER A,B,C,D,E. Can you please help me with that. Please ask me if you need any info.
I’m not sure what your question has to do with MySQL Replication.
you have high load on your severs, I assume from MySQL you need to check MySQL settings and most important queries you’re running to see if you can optimize them. Check EXPLAIN statement for the queries to start with.
The query is also designed wrong. Why would you sort in derived table if you sort again in external query - derived tables do not need order by (unless you use limit)
The problem is when i removed ORDER BY ondate DES and ORDER BY rank ASC then this query will return results in seconds but we need latest date result for which we need to use ORDER BY ondate DES and also we need rank in ascending order so we have to use this ORDER BY rank ASC
I used this query manually but its giving me an error.
mysql> select title AS keyword, rank, ondate from seo_keyword_report where rank>10 sort by rank,date;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘sort by rank,date’ at line 1