The problem
Saving a node with one tag saves normally. With two or more, the save takes upwards of 40 seconds. The problem only occurs after migrating in a set of tags from csv, then creating a mysqldump backup of the database and restoring the database.

Migration Details
4,457 tags were migrated
No errors
The "csv" file is tab separated... so really TSV
The tsv file has two fields only: OldTID and name
The migrated tags are flat: no hierarchy

Configuration Details
Drupal 9.4.7 fresh install via Composer, standard profile
Default theme (Olivero)
Standard install modules only, except for these:

  • migration
  • migrate_plus
  • migrate_tools
  • migrate_source_csv

OS: Ubuntu 22.04 lts
Database server: 10.6.7-MariaDB-2ubuntu1.1 - Ubuntu 22.04
Webserver: nginx 1.18.0
PHP: 8.1.2

Steps to reproduce

  • Install Drupal via Composer: 9.4.7 Standard profile
  • No advanced options during install
  • Add one field to tags taxonomy: field_old_id
  • Install drush via Composer (11.2.1)
  • Install migrate_plus, migrate_tools, migrate source csv
    • Import the config for tags.yml
    • Run migration from drush, importing 4457 tags, flat
    • Create test node, selecting two tags: save is normal, < 2 seconds
    • Backup db using command line mysqldump
    • Create new db
    • Restore db using command line mysql dbname < dumpfile.sql, no changes to codebase
    • Test resave of the same node (2 tags): slow, >40 seconds
    • Test save with one tag: normal, < 2 seconds

The migration yaml config

uuid: 1bcec3e7-0a49-4473-87a2-6dca09b91abax-tags
id: tags
label: Import tags from tsv to taxonomy
migration_group: taxonomy
  plugin: 'csv'
  path: '/srv/imports/tags.tab'
  delimiter: "\t"
  enclosure: '"'
  header_offset: null
  ids: [OldTID]
      name: OldTID
      label: 'Old tag ID'
      name: name
      label: 'Tagname'

  name: name
  field_old_id: OldTID
  plugin: entity:taxonomy_term
  default_bundle: tags
  • Have you profiled the PHP and looked into the slow query log?
    – mona lisa
    Commented Oct 1, 2022 at 17:06
  • 2
    Yes this problem is likely to be localised to your environment, so profiling to find out where the time is being spent is pretty much essential to start the debugging process
    – Clive
    Commented Oct 1, 2022 at 17:16
  • Could this be an issue with the version of MariaDB?
    – Kevin
    Commented Oct 1, 2022 at 17:25
  • New to profiling. Any tools to recommend? Slow query log: should have thought of that. Will take a look.
    – aharown07
    Commented Oct 2, 2022 at 11:47
  • I can tell you we encountered a similar issue in regards to Paragraphs on MariaDB 10.4. When downgrading to 10.3, this particular issue went away. It sounds very close to how you describe it. Can you try another version of MariaDB or just MySQL to rule that out?
    – Kevin
    Commented Oct 2, 2022 at 17:56

1 Answer 1


This is not a complete answer, because we still don't know what in particular misbehaved and why.
But the problem has something to do with that version of MariaDB.

After adding the repository, etc., I was able to upgrade the MariaDB to 10.8.5.

Following the set of steps above, the problem no longer occurs.

  • It is as like as not due to the MariaDB runtime configuration or compiled-in defaults differing between versions as it is an actual bug.
    – mona lisa
    Commented Oct 3, 2022 at 1:59
  • 1
    I've witnessed the same thing with Paragraphs when upgrading (via Pantheon) from Maria 10.1 to 10.4. We had to downgrade to 10.3. It has something to do with how Maria is calculating or caching rows where it makes poor optimizations or something of that nature.
    – Kevin
    Commented Oct 3, 2022 at 23:29
  • Tested also in standard MySQL. Server version: 8.0.30-0ubuntu0.22.04.1 The slow node save (after import, mysqldump, restore, with 2 or more tags on the node) also does not occur in this environment.
    – aharown07
    Commented Oct 6, 2022 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.