update_treestats#
- barecat.Index.update_treestats()[source]#
Recompute size_tree and num_files_tree for all directories.
Uses a bottom-up recursive CTE that expands each file to all its ancestor directories, then aggregates. This is O(files * avg_depth) instead of the naive GLOB/LIKE join which is O(dirs * files).
Performance comparison (10k files, 769 dirs, avg depth ~3):
Method | Time | vs CTE ||--------|——–|-----------| | GLOB | 2.53s | 73x slower| | LIKE | 0.67s | 19x slower| | CTE | 0.04s | baseline |
- On a real dataset (21M files, 341k dirs):
CTE took 170s
GLOB/LIKE would take hours (O(dirs * files) = 7 trillion comparisons)