I am developing an application that will use Oracle , and we have this department hierarchy that we need to display in our database. Something similar to this (I'm sure you all know what I'm talking about, but just in case, I'll include the ERD part):

Thus, it will have stored data that looks like this:
[1 | 0] [2 | 1] [3 | 2] [4 | 2]
In other words:
Department 1 |__Department 2 |___Department 3 |___Department 4
And so on...
This will improve the number of records required in the table, and Data access can be obtained using CONNECT BY , having only 1 registry per department. Usually we consider this tree structure as a solution, but in this new application the performance is critical, so I was wondering if I had a flattened table that looked like this.
[1 | 0] [2 | 1] [3 | 1] [3 | 2] [4 | 1] [4 | 2]
This allows you to have a very obvious relationship without having to know the parent department for a given child in order to find out who its departments are in the higher hierarchy. But this increases the amount of data needed because you need a record for each level the Department is in, which means that if you have a Department level 15 below the top, we need 15 records for it. The department is quite large, so it can become a huge table (about 2 million records).
Well, therefore, after a brief introduction, this is a question; Someone really tried this, which could tell me what is faster / cheaper for a DB between these two options, a huge flat table or a small tree?
source share