Mutliple snapshot tree implementation of adjacency  list using recursive query of PostgreSQL