# Anki-Database-hierarchy

**URL:** <https://forums.ankiweb.net/t/anki-database-hierarchy/70182>\
**Category:** Development\
**Created:** [June 22, 2026, 2:37pm UTC](https://forums.ankiweb.net/t/anki-database-hierarchy/70182 "2026-06-22T14:37:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![liwoe](https://avatars.discourse-cdn.com/v4/letter/l/aca169/32.png) [@liwoe](https://forums.ankiweb.net/u/liwoe)\
**Post date:** [June 22, 2026, 2:37pm UTC](https://forums.ankiweb.net/t/anki-database-hierarchy/70182/1 "2026-06-22T14:37:50Z")

</div>

Anki is currently tracking the hierarchical tree structure of sub-decks exclusively via string delimiters like `\x1f` in it’s collection.anki2 databse.

This seems not to be such a good solution espacially for addon developers and can slow stuff down a bit… it unnecessarily complicates database querying…

(For example I want to find every child of a deck to hash the whole deck but currently I have to use a “long, scuffed” query for this…)

**The Proposal:** I suggest introducing a normalized adjacency relation to cleanly map the tree hierarchy without abandoning the current schema string architecture, if this is wanted I am happy to try to implement it myself and push it…

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [June 22, 2026, 4:02pm UTC](https://forums.ankiweb.net/t/anki-database-hierarchy/70182/2 "2026-06-22T16:02:30Z")

</div>

> [@liwoe](#):
>
> Anki is currently tracking the hierarchical tree structure of sub-decks exclusively via string delimiters like `\x1f` in it’s collection.anki2 databse.

This is an internal implementation detail. It’s never intended to be used by add-ons.

`mw.col.decks` should have all methods you need to find child decks: [anki/pylib/anki/decks.py at main · ankitects/anki · GitHub](https://github.com/ankitects/anki/blob/main/pylib/anki/decks.py)

---

<div class="post-metadata">

**Author:** ![liwoe](https://avatars.discourse-cdn.com/v4/letter/l/aca169/32.png) [@liwoe](https://forums.ankiweb.net/u/liwoe)\
**Post date:** [June 22, 2026, 7:20pm UTC](https://forums.ankiweb.net/t/anki-database-hierarchy/70182/3 "2026-06-22T19:20:14Z")

</div>

Thank you very much that helps me a lot ^^

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [July 22, 2026, 7:21pm UTC](https://forums.ankiweb.net/t/anki-database-hierarchy/70182/4 "2026-07-22T19:21:06Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
