|
4 | 4 | "cell_type": "markdown", |
5 | 5 | "metadata": {}, |
6 | 6 | "source": [ |
7 | | - "# Using UUIDs\n", |
| 7 | + "# Unique Identifiers\n", |
| 8 | + "\n", |
| 9 | + "It is often becomes necessary to assign unique identifiers to entities in a database as *surragate primary key* values. There are many schemes for generating such identifiers.\n", |
| 10 | + "One of the most common approaches in simple cases is an autoincrementing integer field. Most SQL databases support this with built-in features such as `AUTO_INCREMENT` in MySQL or `SERIAL` in PostgreSQL. It's simple and fast.\n", |
| 11 | + "\n", |
| 12 | + "However, autoincrementing ids are not suitable for large distributed systems such as social media platforms (e.g. Instagram). It may be helpful to generate unique identifiers that do not require a database connection or a round-trip to the server.\n", |
| 13 | + "\n", |
| 14 | + "\n", |
| 15 | + "Reading: \n", |
| 16 | + "* Various Unique Identifiers: https://osamadev.medium.com/understanding-unique-identifiers-uid-uuid-guid-cuid-and-nano-id-3ef2d104ecdf\n", |
| 17 | + "* UUIDs: https://en.wikipedia.org/wiki/Universally_unique_identifier\n", |
| 18 | + "* NANOID: https://github.com/ai-sdk/nanoid-python\n", |
| 19 | + "* NANOID Collision Calculator:https://zelark.github.io/nano-id-cc/\n", |
| 20 | + "* Sharding IDs at Instagram: https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c\n", |
| 21 | + "* ULID: https://medium.com/@juniooor/ulid-universally-unique-lexicographically-sortable-identifier-5544e3391660\n", |
| 22 | + "* ULID: https://github.com/ulid/spec\n", |
| 23 | + "\n", |
| 24 | + "\n", |
| 25 | + "## Universally Unique Identifiers (UUIDs)\n", |
8 | 26 | "\n", |
9 | 27 | "Universally Unique Identifiers (UUIDs) provide a convenient mechanism for generating unique identifiers for entities inside an information system. The use of UUIDs is standardized by as RFC 4122.\n", |
10 | 28 | "\n", |
|
26 | 44 | }, |
27 | 45 | { |
28 | 46 | "cell_type": "code", |
29 | | - "execution_count": 3, |
| 47 | + "execution_count": null, |
30 | 48 | "metadata": {}, |
31 | 49 | "outputs": [ |
32 | 50 | { |
|
1764 | 1782 | ], |
1765 | 1783 | "metadata": { |
1766 | 1784 | "kernelspec": { |
1767 | | - "display_name": "Python 3 (ipykernel)", |
| 1785 | + "display_name": "base", |
1768 | 1786 | "language": "python", |
1769 | 1787 | "name": "python3" |
1770 | 1788 | }, |
|
1778 | 1796 | "name": "python", |
1779 | 1797 | "nbconvert_exporter": "python", |
1780 | 1798 | "pygments_lexer": "ipython3", |
1781 | | - "version": "3.9.17" |
| 1799 | + "version": "3.13.2" |
1782 | 1800 | } |
1783 | 1801 | }, |
1784 | 1802 | "nbformat": 4, |
|
0 commit comments