Skip to content

PS-10995 [DOCS] -[feedback] PS 8.4 Innodb index creation - #700

Open
patrickbirch wants to merge 4 commits into
8.4from
ps-10995-8.4
Open

patrickbirch wants to merge 4 commits into
8.4from
ps-10995-8.4

Conversation

@patrickbirch

Copy link
Copy Markdown
Collaborator
modified:   docs/innodb-expanded-fast-index-creation.md

@patrickbirch
patrickbirch temporarily deployed to ps-10995-8.4 - percona-server-docs-8.4 PR #700 April 1, 2026 11:13 — with Render Destroyed
	modified:   docs/innodb-expanded-fast-index-creation.md

@inikep inikep left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the new text against the Percona Server 8.4 source (sql/sql_table.cc, sql/sql_admin.cc, sql/sys_vars.cc, client/mysqldump.cc, storage/innobase/handler/handler0alter.cc) and the MTR tests for expand_fast_index_creation.

What checks out: default OFF, the three restrictions (non-unique keys only, no foreign keys, no partitioning), the description of upstream ALGORITHM=COPY as row-by-row secondary index maintenance, and the overall two-phase model.

Main problems, detailed inline:

  1. OPTIMIZE TABLE (and ALTER TABLE ... ENGINE=InnoDB / FORCE) are in-place rebuilds in 8.4 and never reach the COPY-only delayed-key code, so expand_fast_index_creation does not affect them by default. The PR repeats this claim in many places, including both diagrams.
  2. The variable has no effect on the trailing ALTER TABLE ... ADD KEY from mysqldump --innodb-optimize-keys; the two features are independent.
  3. A garbled paragraph in the tmpdir section.
  4. Four broken #expand-fast-index-creation anchors (should be #expand_fast_index_creation).
  5. One reversed sentence, a few grammar issues, and diagram labels that contradict the text.

Comment thread docs/extended-mysqldump.md Resolved
@patrickbirch
patrickbirch requested a review from inikep November 9, 2026 10:11
…ding

Versions: none added (correction only, no new behavior).
Skipped style fixes: style script not run (spacy not installed for
python3); judgment applied to changed lines.
Conflicts:
- expand-fast-creation.png and technical-view-fast-creation.png not
  regenerated. Both still show OPTIMIZE TABLE and other claims the text
  no longer makes.
- Summary table reviewer note (line 63) has no OPTIMIZE TABLE text.
Placeholders: none.
Added context: innodb_tmpdir note in phase 2 and tmpdir sections.
Change type: correction.

@inikep inikep left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of the technical content against Percona Server 8.4 source (sql/sql_table.cc, sql/sys_vars.cc, client/mysqldump.cc, InnoDB handler0alter.cc) and the feature's MTR tests.

Correct: default OFF, command-line/config-file/session/global (sys_vars.cc); effect limited to the ALGORITHM=COPY path; deferred keys rebuilt with an in-place ADD INDEX, so innodb_tmpdir applies when set; OPTIMIZE TABLE takes the COPY path only with old_alter_table=ON or a FULLTEXT index; UNIQUE keys are never deferred.

Needs fixing (inline): the page confuses rebuild with COPY (column reorder is INPLACE); Phase 2 is one clustered-index scan, not one per index; FULLTEXT and SPATIAL indexes are not deferred; the FK and partitioning restrictions don't match the 8.4 code; the tmpdir margin for the copy belongs on the datadir; the mysqldump FK description contradicts itself and the code; restore doesn't depend on expand_fast_index_creation; both images contradict the text.

The FK and partitioning comments are based on reading the code. Please confirm the runtime behavior on a build.

… scope

Versions: none added (correction only, no new behavior).
Change type: correction.

Scope:
- Deferred-index path runs only for ALTER TABLE ... ALGORITHM=COPY.
  INPLACE rebuilds (column reorder, ROW_FORMAT, ENGINE=InnoDB,
  ADD PRIMARY KEY) are not affected.
- Deferred set is plain KEY indexes (non-unique, non-FULLTEXT,
  non-SPATIAL). FULLTEXT and SPATIAL are still maintained during the copy.
- Phase 2 is one in-place ADD INDEX: one clustered-index scan feeding a
  separate sort/merge per index, not one scan per index.
- mysqldump --innodb-optimize-keys restore does not depend on
  expand_fast_index_creation. Foreign key CONSTRAINT clauses stay in
  CREATE TABLE.
- Copy-side free space is on datadir; tmpdir (or innodb_tmpdir) holds the
  index-build sort runs.
- Variables table: expand_fast_index_creation Option File set to Yes.

Conflicts / open:
- FK and partitioning restrictions not yet confirmed on a build.
- The mysqldump FK-slower-restore claim is unverified.
- expand-fast-creation.png and technical-view-fast-creation.png not
  regenerated; both still contradict the text.

Placeholders: none.
- Foreign keys: optimization is disabled only for tables referenced by
  another table's FK (including self-references) and for ALTERs that add
  an FK. An FK on the table itself does not disable it.
- Partitioning: only statements that change partitioning disable it.
  A plain copy-style ALTER or OPTIMIZE on an already-partitioned table
  can use it.
- mysqldump --innodb-optimize-keys: tables with a foreign key to another
  table are dumped without the optimization. Reason from the source:
  'Table was not locked with LOCK TABLES'.
- Restore: the variable does not affect the trailing ALTER TABLE ADD KEY
  on restore. The benefit comes from the rewritten dump file.
- tmpdir and datadir: the copy's intermediate table is written to the
  table's data directory, so the copy needs free space there roughly
  equal to the rebuilt table.
- Verify and monitor: add how to confirm the optimization ran using the
  stage/sql/restoring secondary keys stage.
- Rename the dump-structure heading to 'Dump file structure' so the
  anchor is the same under both Python-Markdown and pymdownx slugify.
- Remove the two comparison graphics for now; they are being regenerated.

Behavior checked on Percona Server 8.4.13-13.

This branch was successfully deployed

1 active deployment
ps-10995-8.4 - percona-server-docs-8.4 PR #700 — be5ac328 Deployed Nov 30, 2026 by patrickbirch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants