Review main Merged

94037[TASK] Drop redundant uid_local index on MM junction tables

TYPO3com CR +2 V +2 Normal +95 −14 updated 06/10/26, 21:21

Commit message

DefaultTcaSchema enriches MM junction tables with their default
columns and indexes. For relations without "multiple", the primary
key is set to "uid_local, uid_foreign", or to "uid_local, uid_foreign,
tablenames, fieldname" for multi-foreign setups. The separate
single-column index on "uid_local" is a redundant leading prefix
of that primary key and adds write overhead without serving any
lookup the primary key does not cover already.

The patch stops adding the "uid_local" index in this case. It is
still created when "multiple" is set, because the primary key is
"uid" field then and no longer starts with "uid_local".

Dropping the index only avoids some write overhead, so this is a
main-only cleanup.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 813

  1. TYPO3com uploaded patch set 1 05/08/26, 09:51

  2. core-ci voted on patch set 1 V +1 05/08/26, 10:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101722

  3. Garvin Hicking wrote 05/08/26, 10:18

    Change destination moved from 14.3 to main
  4. TYPO3com rebased onto patch set 2 05/11/26, 07:10

  5. core-ci voted on patch set 2 V +1 05/11/26, 07:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101804

  6. Christian Kuhn commented on patch set 2 CR -1 06/05/26, 00:32

    Thanks for the patch. Dropping the single-column uid_local index is correct, it is a redundant prefix of the composite primary key. Since the redundant index does not really hurt apart from some write overhead, this is main-only cleanup territory, which the patch already targets. The unique index is wrong, though: $needsUid means multiple => true, which explicitly allows the same (uid_local, uid_foreign) pair more than once. That is the very reason the surrogate uid primary key exists, see the comment above its creation. A unique index on the pair columns forbids exactly that, the first DataHandler write attaching the same item twice will fail. It would also break existing installations carrying legitimate duplicate rows. The indexes for this branch need to be non-unique. Suggestion: reduce the patch to the uid_local index removal.
  7. Christian Kuhn uploaded patch set 3 CR -1 V +1 06/09/26, 21:46

  8. Christian Kuhn commented on patch set 3 CR +1 V +1 06/09/26, 21:47

    Reply

    Done
  9. Christian Kuhn commented on patch set 3 06/09/26, 21:48

    still unsure with this - a v14 would probably apply cleanly.
  10. core-ci voted on patch set 3 V +1 06/09/26, 21:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/103249

  11. Stefan Bürk voted on patch set 3 CR +1 V +1 06/10/26, 13:35

  12. Christian Kuhn commented on patch set 3 CR +2 V +2 06/10/26, 21:21

    Reply

    ok, stefan told me he leans towards main-only for this as well, so let's follow that.
  13. Christian Kuhn merged patch set 4 06/10/26, 21:21