I have published two small scripts that allows to create and restore data from mysql database filtered by date, so I can define this as incremental backup. Article describes the backup/restore scripts configuration. The scripts themselves can be downloaded from the GitHub, links are available at the end of the article.
Article describes algorithm of random row selection based on weight, so some rows will be selected more often than other. Article includes sample codes, so I hope will bу helpful to somebody.
Do not hesitate to leave comments if you have ideas how to improve the algorithm.
Random rows selection may be slow and there are several commonly used solutions to solve this problm could be googled. In my article I am trying to review a few algorithms and to describe benefits and limitations of them.
Let me know if I have missed some good algorithm.
As I have mentioned in one of my previous articles I am slightly disappointed in MySQL prepared statements, so I decided to look to theold and proven ways to improve the speed of the MySQL interaction. But what is even more impressive this approach allows even reduce hardware utilization.
This article describes SQL only and does not include PHP or erlang implementations, I hope publish some code soon.