I would like to implement a linked list in Postgresql and I imagine it is the same as implementing a list using array indexing. In DB, table and primary key will do the job I suppose. For
a -> b -> c -> d -> e and 1 -> 2 -> 3 -> 4 representation will be:
[0] -> {"a", 1}
[1] -> {"b", 2}
[2] -> {"c", 4}
[3] -> {"1", 5}
[4] -> {"d", 7}
[5] -> {"2", 6}
[6] -> {"3", 8}
[7] -> {"e", nil}
[8] -> {"4", nil}
Because I have not enough SQL knowledge so I still struggle with Postgresql implementation. Could you elaborate on this? INSERT should add at the end and SELECT result should start from the end. Nor UPDATE and DELETE are required if this is helpful for the optimization.