> For the complete documentation index, see [llms.txt](https://til.notdu.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.notdu.com/database/intro-to-database-systems/tree-indexes-ii/b+tree-duplicate-keys.md).

# B+Tree: Duplicate Keys

Approach #1: Append Record Id

* Add the tuple's unique record id as part of the key to ensure that all keys are unique.
* The DNMS can still use partial keys to find tuples.

![](https://2548495579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTsnKOX7xLvOtvOXY9MlI%2Fuploads%2FFszfbkOsAre08nO9A1rq%2Fimage.png?alt=media\&token=6a177792-2512-4a7e-a202-32c0daac24d1)

Approach #2: Overflow Leaf Nodes

* Allow leaf nodes to spill into overflow nodes that contain the duplicate keys
* This is more complex to maintain and modify

![](https://2548495579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTsnKOX7xLvOtvOXY9MlI%2Fuploads%2FULj1zWOI0GuFOvzKOgFC%2Fimage.png?alt=media\&token=4a899657-0d76-4792-bce1-9c7b1f24d18a)
