Re: Why does the limit use the early row lookup.

2012-04-20 Thread Reindl Harald
i know what it does, but it is simply idiotic select pri_key_field from table order by rand() limit 10; why in the world can this not be doe with an index? only the auto_increment field is involved soryy, no understanding it is idiotic that you need to "select pri_key_field from table" and fetch

RE: Why does the limit use the early row lookup.

2012-04-20 Thread Rick James
Any ORDER BY (that cannot be done using an index) will gather all the data first, then sort, then do the LIMIT. Potential optimizations include * Keep a "pointer", not the whole data. (This may be practical for SELECT *, but not practical in other cases.) * Build a "priority queue" with only

Re: Maser-Slave replication is playing up

2012-04-20 Thread shawn green
Hello Egor, On 4/20/2012 8:52 AM, nixofortune wrote: Hi Shaw, I have two more question here. 1. Why those rows hasn't been deleted on slaves? 2. Why no slow logs entries were created? Many thanks for your time and effort. 1) Perhaps the slave has not reached that point in the binary logs? You

Re: Maser-Slave replication is playing up

2012-04-20 Thread nixofortune
Hi Shaw, I have two more question here. 1. Why those rows hasn't been deleted on slaves? 2. Why no slow logs entries were created? Many thanks for your time and effort. Egor On 20 April 2012 12:51, shawn green wrote: > Hello Egor, > > > On 4/20/2012 7:17 AM, nixofortune wrote: > >> Hi guys, >>

Re: Maser-Slave replication is playing up

2012-04-20 Thread nixofortune
Hi Reindl, Many thanks for your contribution. I did remember we discussed rsync backup method in the past and I was able successfully to do this on our staging 100Gig + MASTER<=>MASTER replication setup. The downtime was really minimum, minutes not hours. It used to fail on regular basis as we tri

Re: Maser-Slave replication is playing up

2012-04-20 Thread nixofortune
Hi Shawn, Great! This is most likely what happened. I saw yesterday when the drama developed, that mysql does huge amount of select queries, but couldn't identified the source. the was no long running threads, no slow logs entries as well. Now I understand what happened. This is a table definition

Re: Maser-Slave replication is playing up

2012-04-20 Thread Reindl Harald
Am 20.04.2012 13:44, schrieb nixofortune: > Thanks, > So the actions should be: > 1. Stop slaves > 2. On Slaves: SET GLOBAL binlog_format=MIXED > 3. Start slaves. not "SET GLOBAL", put things you want in my.cnf you want them also get active after restart :-) > What is "restart the replication f

Re: Maser-Slave replication is playing up

2012-04-20 Thread shawn green
Hello All, On 4/20/2012 7:44 AM, nixofortune wrote: Thanks, So the actions should be: 1. Stop slaves 2. On Slaves: SET GLOBAL binlog_format=MIXED 3. Start slaves. What is "restart the replication from scratch with a binary ident copy (rsync)" Is it to use rsync to rsync mysql data on masters an

Re: Maser-Slave replication is playing up

2012-04-20 Thread shawn green
Hello Egor, On 4/20/2012 7:17 AM, nixofortune wrote: Hi guys, I'm am experiencing strange behaviour with the replication. Our replication Setup looks like this: Master1(5.1.46-log) =Master2(5.1.46-log) / |

Re: Maser-Slave replication is playing up

2012-04-20 Thread nixofortune
Thanks, So the actions should be: 1. Stop slaves 2. On Slaves: SET GLOBAL binlog_format=MIXED 3. Start slaves. What is "restart the replication from scratch with a binary ident copy (rsync)" Is it to use rsync to rsync mysql data on masters and slaves? and than run chnge the master to to star

Re: Maser-Slave replication is playing up

2012-04-20 Thread Reindl Harald
Am 20.04.2012 13:17, schrieb nixofortune: > So far I found : > binlog_format different: > Masters (MIXED) > Slaves (STATEMENT) > > sync_binlog different on one of the slaves: 1024 against 0 on the rest binlog format "statement" is practically unuseable there are way too much possible queries

Maser-Slave replication is playing up

2012-04-20 Thread nixofortune
Hi guys, I'm am experiencing strange behaviour with the replication. Our replication Setup looks like this: Master1(5.1.46-log) =Master2(5.1.46-log) / |\ Slave1(5.1.46-log) Slave2(5.1.52) Slave3(5.1.52)

Re: Why does the limit use the early row lookup.

2012-04-20 Thread Reindl Harald
Am 20.04.2012 04:29, schrieb 张志刚: > My point is that the limit can use late row lookup: lookup rows after > checking indexes to optimize the select speed. > > But the mysql optimizer do it with the early row lookup: lookup all rows > before checking indexes when the one fetch column is not in th