have a case like that before insert into table A ,i need select count(x) as sum from tableA . if sum < Y ,then insert . so i want to have a table lock before count