I have a server program that works with database and N clients that are connected to server. In database I have a table of persons with about 10 000 persons. Now on X client the following sql query is executed:
SELECT * FROM persons WHERE age >18 AND sex=1 ORDER BY age.
And ordered list of 2500 persons is shown to X client. If there are changes on server side then list of persons shown to X client must be updated in most effective way.
Now on server side person with id =120 was updated by some client. After this update we don't know his age and sex. So there are two situations:
So what is the most effective way to find now out - if person with id=120 is in X selected persons or isn't? Is this person is, then what is its position? I consider here the easiest case, but what if there are three of five updates? What to do this case?
I think that there are solutions for such synchronization of existing result set with database if data change but I can't find necessary words to find it in internet. Please, any hints any solution/algorithm names.