I understand (maybe wrongly) that SQL databases often use associative arrays based on B-trees and that looking up entries in these arrays entails binary search that lexicographically compares a key with the keys in the array.
I wonder whether, in a database with many tables, if many of those tables' names have similar "namespace" prefixes, such as inventory_...
or accounting_...
or cached_resources_for_...
, queries will be slowed in any significant way if the table names need to be looked up in a B-tree and, in the binary search, when comparing keys that all look like some_long_prefix_...
, the string comparison routine needs to look farther into the names to get past the common prefix.
I wonder whether giving table names unique prefixes, such as serial numbers, like 123_cached_resources_for_foo
versus 124_cached_resources_for_bar
, would improve performance in any significant way.
This question is not about Hungarian notation like prefixing every table's name with tbl_
.
If it matters, I am interested primarily in PostgreSQL and SQLite.