Closed s4ke closed 8 years ago
Such a query should do the job:
SELECT * FROM author_bookhsearchupdates t1 INNER JOIN ( SELECT max(t2.updateidhsearch) updateid, t2.authorFkfk, t2.bookFkfk FROM author_bookhsearchupdates t2 GROUP BY t2.authorFkfk, t2.bookFkfk ) t3 on t1.authorFkfk = t3.authorFkfk AND t1.bookFkfk = t3.bookFkfk AND t1.updateidhsearch = t3.updateid;
when deleting the updates, we have to make sure that we delete all the updates we already handled. this can be done with something along the lines of
DELETE FROM author_bookhsearchupdates WHERE updateidhsearch < id_of_last_update
This will reduce the database/indexing load heavily for incremental changes.
deleting implemented.
only select the most recent update event if that's possible.