2

I have two sources of data , I fetch data from both the sources and combine them on basis of date and send as response.

Now I am trying to send response as a paginated response but I don't have idea how to do this because there is no way to know how many rows should be asked from source 1 and source 2.

for example :

consider two tables : comments and likes

one store comments :(this is a mysql table)

comment Date

second store like :(this I compute from some other data source)

Like Date

now I want send comments and likes combine result as paginated,

suppose I ask for response with offset = 0 and limit =20

here I don't know how many rows I should take from comment table and how many from like data source. for first time I can merge data and slice first 20 but for this I will have to merge these data source all the time and then slice (which is not possible due to constrain)

limitations : cannot have them in same table or db and cannot merge complete data every time and send response by slicing.

please help me to figure out this problem. I have tried to explain everything at my fullest. please ask if anything else needed.

  • What kind of merging are you doing ? Are the comments and likes pointing to the same resource, say a post for example ? If so, you can try joining them at the DB side itself and have the data paginated in the DB side. – v1shnu Nov 16 '21 at 13:46

0 Answers0