I have a vocabulary with around 15k+ terms in multi-level hierarchies. Recently I noticed that with this amount of data, when I try to save a term of a higher level (parent to many), it takes a lot of time to save.
I checked with the webprofiler module and saw there was around 10k queries running for such a single term including the queries it is running for it's children. I am not sure if this is expected, but is there a way I can speed up the process? These queries includes tables like cache, path_alias, taxonomy_term_data, taxonomy_term_revision, key_value etc.
I have tried applying memcached that considerably reduces the queries, specially from the cache tables, but still the child term queries are run slowing down the process.
I also considered running the process in background, but in that case also, it supposedly should take the same amount of server resources. The problem is so much so that my entire application is going into a halt state (sometimes unavailable) when I am updating some terms through a drush command.