I simply gave an example that some existing tool or algorithm could be used. Obviously it
cannot be based on single heuristics and it is definitively a highly experimental
endeavour.
The applicability of huffman encoding is as following:
1. list all the involved tables with their frequency in the SQL;
2. use huffman algorithm to assign shorter alias to table with more frequency so the
overall SQL is the shortest
Again, just an example. Obviously SQL length cannot be the only perspective, if it
counts.
There are many more perspectives to take into consideration, e.g.:
* using common abbreviation convention (e.g., hibernate -> hbt);
* similar table names have similar abbreviations;
* ... ...
Just a high level thoughts. We can make incremental progress by simulating human pattern.
E.g., we can compare the SQL produced by Hibernate with the one provided by human and
inspect the difference. There should be tons of patterns and heuristics seems inevitable.
This should not be a normal issue solved by one single ticket. It involves research and
even the 'AI' buzzword.