# Taxon tree manipulations lock database

**URL:** <https://speciforum.org/t/taxon-tree-manipulations-lock-database/1309>\
**Category:** Get Help\
**Created:** [September 13, 2023, 8:42am UTC](https://speciforum.org/t/taxon-tree-manipulations-lock-database/1309 "2023-09-13T08:42:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedoras](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/fedoras/32/455_2.png) [@fedoras](https://speciforum.org/u/fedoras)\
**Post date:** [September 13, 2023, 8:42am UTC](https://speciforum.org/t/taxon-tree-manipulations-lock-database/1309/1 "2023-09-13T08:42:45Z")

</div>

We’ve been having episodes where any larger manipulation done to the taxon tree by anyone locks the database for minutes affecting other users and giving them timeouts, much to their confusion and frustration. We are already soon moving to more powerful servers, but I fear this will not be enough. We need a long term solution to this, because we’re only quickly adding more taxa soon.

I understood the foundational problem with the tree are the child node numbers and the time spent recalculating these upon every change to the tree. When moving entire branches, this process obviously has to traverse all the child branches recursively to ensure the integrity of these numbers.

I was told that a solution is being worked on, where this will be done in a different way, so no performance problems will be noticed. I would like to hear a timeline on when we can expect this to be implemented.

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [September 14, 2023, 11:31pm UTC](https://speciforum.org/t/taxon-tree-manipulations-lock-database/1309/2 "2023-09-14T23:31:16Z")

</div>

Hi @fedoras,

I spoke to one of our developers and he put together a list of upcoming changes related to your inquiry:

There are two bottlenecks when creating new taxon nodes and performing tree mutations.

1. The first is rebuilding the full names when changes are made.

2. The second bottleneck, which occurs because the entire tree is renumbered each time a change is made, has been partially resolved. You can find an early draft of this fix on the [`node_numbering_fix`](https://github.com/specify/specify7/compare/production...node_numbering_fix) branch.

3. We have improved the speed of tree count queries by implementing recursive CTE queries in the code. This improvement is included in the pull request [#3613](https://github.com/specify/specify7/pull/3613). This fix will also be include in Specify `7.9.1`.

Thank you for reaching out to us and inquiring about our progress on these issues! We are optimistic that these upcoming updates will significantly improve tree performance in the next few months.

---

<div class="post-metadata">

**Author:** ![rdrinkwater](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@rdrinkwater](https://speciforum.org/u/rdrinkwater)\
**Post date:** [September 21, 2023, 11:57am UTC](https://speciforum.org/t/taxon-tree-manipulations-lock-database/1309/3 "2023-09-21T11:57:00Z")

</div>

Thanks for sharing the planned fixes - it’ll be great to get to try these out. We have experienced similar issues to Fedoras with users experiencing issues if the there is work being done in the tree. We have also found that workbench uploads including taxa cause users to experience crashes and problems working with taxa - we currently have a period of time once a week where workbench uploads take place to minimise disruption.

---

<div class="post-metadata">

**Author:** ![fedoras](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/fedoras/32/455_2.png) [@fedoras](https://speciforum.org/u/fedoras)\
**Post date:** [October 9, 2023, 9:10am UTC](https://speciforum.org/t/taxon-tree-manipulations-lock-database/1309/4 "2023-10-09T09:10:04Z")

</div>

Oh yes indeed I forgot to mention that this especially occurs when importing with Workbench to the point that we are now forced to do imports outside of office hours.
