Standardize table identifiers/names and merge them efficiently I hope this is the right place to ask the following question.
I have N tables (N>1000). The rows (all, or some of them) of each table may (or may not) be merged with other rows in other tables, following a specific process that is irrelevant here. Every table has the same columns.
At the end of the process, I have a single, huge, master table.
In this master table, each row is the product of 0, 1, or more mergers.
For each row, I need to find a way to identify from what tables it comes from. For example:
If a specific row is the product of a row from table "A" and another row in table "B", then I need a key/name/identifier like "A+B" or "AB". However, since the mergers can even be like >1000, this will result in a too-long string.
In addition, the current table names are not just "A" or "B" but they are longer strings.
Any ideas? Thank you in advance.

Order the tables by how often they appear in mergers. Then assign to each table a bit in a bit-sequence of length $N$, according to this order, i.e. the most frequent table will get the left-most bit. Next, assign to each row the bit sequence that has bit $k$ set if and only if the table belonging to this bit is part of the merger of this row. Then truncate those bit-sequences by removing padding zeros on the right.
