1. A method for operating a database apparatus, comprising: storing each of a plurality of data identifiers in a distributed memory apparatus as a two-level indexed data structure, wherein a first level of each data structure includes a first unique set of decreasing integers, wherein a second level of the data structure includes a plurality of unique sets of decreasing integers, wherein each of the plurality of unique sets is linked to one of the integers in the first unique set, wherein each integer in the first unique set represents a first portion of the data identifier and each unique integer in the plurality of sets represent a second portion of the data identifier; performing a query operation using the data identifiers and storing the result of the query operation in the distributed memory apparatus as a resultant two-level data structure, the query operation finding a union set between a first data structure and a second data structure by performing a first series of comparison operations between the first level integer sets of the first and second data structures to identify matched and unmatched integers in the first level integers sets; if a first integer in the first level of the first data structure is not found in the first level of the second data structure, retrieving the unique set of second level integers that is linked to the first integer and storing the unique set of second level integers in the second level of an indexed data structure, and adding the first integer to the union set; if a matched integer is identified in the first level integers sets, performing a second series of comparison operations between the second level integer sets of the first and second data structures to identify matched and unmatched integers in the second level integer set of the first and second data structures, and storing the matched unmatched integers in the second level of the second data structure with a link to the matched integer in the first level of the second data structure; and repeating the steps of performing the first and second series of comparison operations until done.