elgentos/masquerade

tableRanges accepts only integer PK

fliespl opened this issue · 2 comments

Won't work with UUID or string PK like slack identifier (i.e. U0103P9J5ME)

Just an idea that might be worth checking:

select min(sub.id), max(sub.id) from (
    SELECT id, ROW_NUMBER() OVER (ORDER BY id ASC) as rownumber from slack_user
) sub
group by ceil(sub.rownumber/5)*5;

This also improved selecting ranges when you are using HA setup where ids might not be sequential, cause it will create equal groups.

In your current code, it would select all records at once:
https://ss.codeone.pl/ss-2022-01-02-21-00-06-1641153606-jUDXfXMY.png

Once with above:
https://ss.codeone.pl/ss-2022-01-02-21-00-24-1641153624-PrIxomJi.png

Cool, I'll welcome a PR!