Speed Issues after adding 200k+ records to Contacts Module

Working with a client that has some custom modules they're using like the Contacts module, but in order to leverage some existing plugins, we want to sync that module back to the Contacts module.

I've got the SQL all written to do this, including setting the custom table data and the relationship data and what have you, and if I only do about 100k of the 580k records, everything looks good, the Contacts list view populates with 20 rows in about 2-3 seconds.

However the minute I start moving across more than 100k rows, the load time for the list view api call goes up exponentially, like, 200k records suddenly takes 20 seconds, and if I go all 580k records, I'm looking at over a minute before the listview populates.

Yet if I go to the custom module that I'm syncing from, that has the same 580k records, it loads in 4 or 5 seconds.

I have tried just doing contacts, or both normal and _cstm, and then with the relationship, etc, etc, and it doesn't seem to make much difference.

Any ideas or suggestions?


Thanks,

Arthur