Tidb id暴增问题

当时一个分段对比数据脚本改了一下,就当前的问题你看对你有帮助没:
minid=mysql -h -u -p -e"select min(id) from t"
maxid=select max(id) from t

ksid=$minid
let zjid=($maxid-$ksid)/2
let jzid=$ksid+$zjid
while ture
do
sycount=mysql -h -u -p -e"select count(*) from t where id=>$ksid and id <=$maxid"
if [[ “$sycount” -gt “10” ]];then
count=select count(*) from t where id=>$ksid and id <$jzid
while ture
do
if [[ “$count” -gt “10” ]];then
let zjid=$zjid/2
let jzid=$ksid+$zjid
count=mysql -h -u -p -e"select count(*) from t where id=>$ksid and id <$jzid"
else
echo “select * from t where id=>$ksid and id <$jzid”
let ksid=$jzid
let zjid=($maxid-$ksid)/2
let jzid=$ksid+$zjid
break
fi
done
else
echo “select * from t where id=>$ksid and id <$jzid”
exit
fi
done

1 个赞