We have a orders table and a contacts table. The contacts table has close to a billion records. These two tables are in two different DBs
I need to select orders based on a criteria. Then for each order, I need to lookup the contact record(s) by contact_id. There is a many-to-many relationship between the two tables
One option is to select the orders by criteria and then pull ALL the data from the contacts table, and then perform a join using the join Join Shape. This works, but takes forever, especially if the contacts data is not cached. We can not cache the contacts data as it being constantly updated.
We only select ~1000 orders at a time, so using the Join shape create a huge overhead.
Is there a better way to implement this?