title: Does MySQL performance schema staging take account of partitions?
body: <p>I am running a large <code>ALTER TABLE</code> operation on a MySQL 5.7 instance (large meaning adding two nullable columns at the end of the row to a table with 800 million rows, total size about 170GB). After a false start where the operation failed (after exceeding <code>innodb_online_alter_log_max_size</code>), I am running this with the performance schema enabled and monitoring this by watching <code>performance_schema.events_stages_current</code>. The DB is hosted in AWS RDS, but I don't think this is hugely relevant because I'm using MySQL native performance schema monitoring rather than RDS Performance Insights.</p>
  <p>I was expecting this to run through the following stages:</p>
  <pre><code>stage/innodb/alter table (read PK and internal sort)
  stage/innodb/alter table (merge sort)
  stage/innodb/alter table (log apply table)
  stage/innodb/alter table (log apply index)
  stage/innodb/alter table (insert)
  stage/innodb/alter table (flush)
  stage/innodb/alter table (end)
  </code></pre>
  <p>But what actually happened is that this sequence has (so far) occurred multiple times in succession without the <code>ALTER TABLE</code> completing. I'm guessing that this is because the table is partitioned, but would like to be able to confirm this to help me to estimate the total time that the <code>ALTER TABLE</code> will take. I can't find any specific reference to this in the MySQL documentation.</p>
  <p>For reference, the <code>ALTER TABLE</code> command looks like this (mildly anonymized):
  <code>ALTER TABLE mytable ADD newcol1 BIGINT NULL, ADD newcol2 VARCHAR(20) NULL</code></p>
  <p>Table structure before this change:</p>
  <pre><code>CREATE TABLE mytable (
    id bigint(20) NOT NULL AUTO_INCREMENT,
    existing_col1 varchar(255) DEFAULT NULL,
    existing_col2 bigint(20) DEFAULT NULL,
    existing_col3 bigint(20) DEFAULT NULL,
  [a bunch of other columns not relevant here and not in any index]
    UNIQUE KEY unique_idx (existing_col1,existing_col2,existing_col3),
    KEY idx2 (existing_col1,existing_col2),
    KEY idx_id (id)
  ) ENGINE=InnoDB AUTO_INCREMENT=783798650 DEFAULT CHARSET=latin1
  /*!50100 PARTITION BY RANGE (existing_col2)
  (PARTITION P0 VALUES LESS THAN (1420070400000) ENGINE = InnoDB,
   PARTITION P2015 VALUES LESS THAN (1451606400000) ENGINE = InnoDB,
   PARTITION P2016 VALUES LESS THAN (1483228800000) ENGINE = InnoDB,
   PARTITION P2017 VALUES LESS THAN (1514764800000) ENGINE = InnoDB,
   PARTITION P2018 VALUES LESS THAN (1546300800000) ENGINE = InnoDB,
   PARTITION P2019 VALUES LESS THAN (1577836800000) ENGINE = InnoDB,
   PARTITION P2020 VALUES LESS THAN (1609459200000) ENGINE = InnoDB,
   PARTITION P2021 VALUES LESS THAN (1640995200000) ENGINE = InnoDB,
   PARTITION P2022 VALUES LESS THAN (1672531200000) ENGINE = InnoDB,
   PARTITION P2023 VALUES LESS THAN (1704067200000) ENGINE = InnoDB,
   PARTITION P2024 VALUES LESS THAN (1735689600000) ENGINE = InnoDB,
   PARTITION PE VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
  </code></pre>