In an RDBMS, join optimisation relies on having fixed length fields (so it can build a cross-product in memory). A perl scalar for the reasons you point out can't be fixed length and so it would be harder (but not impossible) to write a perl-like RDBMS which delivered reasonable performance.