Hi Gordan,

Do you see any reason why we shouldn't first run the CREATE INDEX statement on the slaves and then run the same command on the master, 
while ensuring it's not written to the binary log?

In this order, we will eliminate the slave lag.

For example, on the master, we could disable binary logging temporarily:

-- Disable binary logging for the current session
SET sql_log_bin = 0;
-- Run the CREATE INDEX command
CREATE INDEX ix_index ON t1 (col1, col2) ALGORITHM=INPLACE, LOCK=NONE;
-- Re-enable binary logging
SET sql_log_bin = 1;


Edi

On Sat, Mar 22, 2025 at 9:23 PM edi mari <edim2525@gmail.com> wrote:
Thanks for the explanation.

Edi

On Sat, Mar 22, 2025 at 8:40 PM Gordan Bobic <gordan@shatteredsilicon.net> wrote:


On Sat, 22 Mar 2025, 20:02 edi mari, <edim2525@gmail.com> wrote:
Thanks Gordan.
This is a cluster and I have slaves.
How does the  ALGORITHM=INPLACE, LOCK=NONE; configuration impact the slaves ? 

The slaves will start the ALTER when it gets in the binlog - which will happen when ALTER completes. So if it takes an hour for that ALTER to complete, your slaves will get a 1 hour lag spike that won't start to clear until they finish executing the ALTER they replicated down.