Repository navigation
Conversation
…tead of linear search
|
The only question is - why tree? Did you try with hash? |
To compete with the tree speed-wise, the hash table should be rather large (way more than 10000 buckets). I tried our Another option could be |
|
Hello. I have some spare ChatGPT usage so I checked this. If you don't want me to do this, let me know. Summary: metadata lookup is measurably cheaper with this change. No functional regression was found in the tested cases. Compared TCP restore to the same unchanged server showed 3.9% lower median elapsed time and 46.7% less CPU in the gbak client. TCP elapsed-time measurements were noisy, so that percentage is only indicative. No reliable elapsed-time gain was established for the small database or the 1,500-table case without additional grants. Functional checks passed for full and metadata-only restore, |
The original code used O(n) linear searches through linked lists (
relations / packages / procedures / miss_privs) for object lookups duringget_user_privilegeprocessing.This PR replaces linear linked-list traversals with a tree-based dictionary lookups via
MetaDictionary, keyed by(object_type, QualifiedMetaString).The measured effect is up to 20% restore time decrease for artificially generated metadata and 9-10% decrease for real-world database containing 1,941,409 user privileges. This is for metadata-only restore, of course. The numbers are not very impressive, but even a small boost wouldn't hurt, I suppose.