228 words, 2 min read
Think about your everyday online life. Have you ever been deep in an email conversation, where each message is a reply to a previous one, creating a long chain? Or maybe youâve seen a lively discussion on X (the app formerly known as Twitter), where people reply to comments, and then others reply to those replies, building a huge, sprawling chat.
These common online experiences show us a tricky but fascinating type of data: information thatâs deeply connected, like branches on a tree. Itâs not just emails and social media; imagine a companyâs structure (who reports to whom), or products organized into main categories and then smaller sub-categories.
The big question for us, as programmers, is: how do we get this kind of linked data out of our âŚ
228 words, 2 min read
Think about your everyday online life. Have you ever been deep in an email conversation, where each message is a reply to a previous one, creating a long chain? Or maybe youâve seen a lively discussion on X (the app formerly known as Twitter), where people reply to comments, and then others reply to those replies, building a huge, sprawling chat.
These common online experiences show us a tricky but fascinating type of data: information thatâs deeply connected, like branches on a tree. Itâs not just emails and social media; imagine a companyâs structure (who reports to whom), or products organized into main categories and then smaller sub-categories.
The big question for us, as programmers, is: how do we get this kind of linked data out of our databases in a smart and easy way? If we donât know how many levels deep the connections go, a simple way of linking tables wonât work.
This is where a special trick in databases called Common Table Expressions (CTEs) comes in, especially the ârecursiveâ kind. These are like magic tools that help us follow these deep connections. Even though CTEs are a database feature, Elixir, with its Ecto tool, now has a really clean way to use them right in your Elixir code. In this article, weâll explain what these ârecursive CTEsâ are, why theyâre perfect for finding these connectedâŚ
â ď¸ This post links to an external website. â ď¸
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.