I have a many-to-many table with recursive relationships(child_id, parent_id) in the form of an acyclic directed graph, and I need to cascade unfold this graph from a particular graph node, which will be the root. How do I shard this table to avoid multiple network requests in case a certain child element is located on a different shard of the database from the parent? Sharding is necessary as the number of records in the relationship table can easily exceed the storage space of any drive.
I have absolutely no idea how it is possible to somehow optimize such a request