Creating pagination from multiple sources

Viewed 8165

I need to create an HTML table with pagination. The data comes from 2 different sources (could be 2 tables from 2 different databases like one Oracle and another is MySQL) which you can't use joined select statement. To make it more complicated, I need to display the data sorted by timestamp (one of the property is timestamp) in ascending order.

For example, source A has 45 records, source B has 55 records. So the table will display total records of 100, but only display let's say 15 records at a time. So there has to be 7 pages (6 pages with 15 records and 1 page with 10 records).

The above example are just a total of 100 records which might be easy for the memory to load them all. But in actual production, it could be thousands or millions records. Does anyone know any algorithm that I can use? The parameters that I can provide are page number and the number of record per page.

1 Answers
Related