High concurrency, how to record the number of clicks, there will be no repetition?

In the

high concurrency environment, I want to record the number of clicks per click. The database self-increasing field is id , but there is already a lot of data in it. You can"t use id to identify the clicks. If there is any way of thinking, there will be no duplicate records. What I think of is locking the table.

Mar.09,2021

if the experience of locking the table is not good, the front end will wait too long.
message queuing is recommended.

  1. N individual click, directly into the queue, this is in sequence. And no lock, high performance
  2. background opens A consumer process reads from the message queue, which is in the order you want
< H1 > queue-first in, first out (FIFO,first in first out) < / H1 >
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3326d-2abb6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3326d-2abb6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?