Flat storage acts as a database index for values stored in the NEAR state trie. While the standard state trie is stored in RocksDB using DBCol::State (content-addressed via hash(borsh_encode(trie_node))), flat storage stores a copy of the data in a more accessible format to reduce lookup time.
Algorithmically, it attempts to move lookup complexity from O(d) (where d is tree depth) to O(1). In practice, the performance gain comes primarily from better data layout and smaller column size in RocksDB (DBCol::FlatState), resulting in observed speedups of 100x or more for reading single values compared to the state trie.