8 ms·
I'm wondering ... so when a user requests a page which will have a full hierarchy of blocks, how are the db queries done. Do you first query the root to see it
by gg2222 5y ago
I'm wondering ... so when a user requests a page which will have a full hierarchy of blocks, how are the db queries done.
Do you first query the root to see it's content blocks, then make additional queries to load the root's children block, then make additional queries to get those blocks children blocks (ie. recursively) until there are no more children?
Does that result in too many database queries? Or do you have other ways to optimize it?
- andyjohnson0 5y agoIt appears that Notion uses Postgres, which supports the recursive/hierarchical queries that are part of standard SQL [1]. While I don't know for sure that Notion uses this, it seems likely. [1] https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL https://en.wikipedia.org/wiki/Hierarchical_and_recursive_que...