Slide 15
Slide 15 text
Per segment
SELECT count(*),
sum(cast(conv(substring(md5(concat(id,
updated_at)), 18), 16, 10) as unsigned))
FROM `some_table`
WHERE (id >= 1) AND (id < 100000)
● Concatenate columns of interest: here id and updated_at
● Calculate MD5 over each concatenation of each row
● Preserve the first 18 characters of the calculated hash
● Convert it from a 16-hexadecimal to 10-base decimal system
● Cast the value for each row to an unsigned integer
● Sum all integers of the entire segment