search

Home  >  Q&A  >  body text

php+mysql high concurrency how to download data in a loop based on ID to avoid duplication (interface)

For example, the table content is

id name

1 a

2 b

3 c

4 d

th The first download id is 1

The second download id is 2

The third download id is 3

The fourth download id is 4

## After #id is 4, it starts from 1 again and keeps looping indefinitely. It must be able to support high concurrency!

Before I used to save the id in another table. Every time I downloaded, I read the last id from the table. When downloading the data, I just needed data larger than this id, but the concurrency was high. Duplicate data will be downloaded, and it is a bit troublesome to operate another table. Does anyone have any other good methods?

。。。。。。。。1755 days ago1072

reply all(1)I'll reply

  • 小可耐

    小可耐2020-02-12 12:37:34

    Add delay or array_unique. The main thing is not to download duplicate data, and not to download the ID for use.

    reply
    0
  • Cancelreply