Patent ID: 7702619

Claim:
A computer implemented method for identifying joined rows in a database comprising a plurality of tables, the method configuring one or more processors to perform an operation comprising: selecting a group of tables from the plurality of tables, each table of the group of tables being directly or indirectly joined with each of the other tables in the group of tables; selecting an order of the group of tables based on relationships among the group of tables; generating an intermediate data structure comprising information identifying each of the group of tables, a number of virtual tables equal to one less than a number of tables of the group of tables, each virtual table comprising information identifying two or more tables of the group of tables, and an indication of an adjacent table, a common table and a common key for at least some tables of the group of tables or the virtual tables; generating an indexing data structure for each table of the group of tables and each virtual table of the virtual tables; inserting data pointers and data elements from rows of the group of tables into the indexing data structures using the intermediate data structure, wherein the indexing data structure for one of the virtual tables indicates which of the rows of the group of tables have common data elements; and wherein selecting the order of the group of tables comprises: (a) creating first and second auxiliary data structures; (b) inserting one of the group of tables into the first and second auxiliary data structures; (c) designating a first table in the first auxiliary data structure as a current table; (d) for each adjacent table of the group of the tables that has at least one column which corresponds to a column of the current table and has not already been inserted in the second auxiliary data structure, inserting the adjacent table into the first and second auxiliary data structures; (e) removing the current table from the first auxiliary data structure; and (f) repeating steps (c) to (e) until the first auxiliary data structure is empty.