I have an analytics platform with lots of users and hundreds of inserting clicks / minute.

Sometimes I see that the exact same click is inserted to the Database within the same second and it becomes a duplicate of the other.

I have a system which checks if the table has the same value and not letting the other inserted if it finds one.

However in this case it looks to me that they're inserted into the DB in the exact same milisecond.

What can I do here?