I have a table with the main keys in a row , for example 12a4... , c3af... I want to process them in parallel:
process_them(1,4) on machine 1 process_them(2,4) on machine 2 process_them(3,4) on machine 3 process_them(4,4) on machine 4
The implementation of the above should select all the rows in the table, without matching the machines with each other. The best idea I can come up with is to split them into 16, for example:
select * from table where id like '1%' ... select * from table where id like 'e%' select * from table where id like 'f%'
Is there a better idea that allows me more sections like 1/2, 1/4, 1/8, 1/16, 1/32 etc. from all the lines?
Note. I do this to process user data at night and send their notification. I do not edit anything in the database itself. And we need to process thousands of users at a time, it cannot be divided in a fine-grained way, since it will not be effective in this way.
source share