mysql find smallest + unique id available

后端 未结 7 648
忘了有多久
忘了有多久 2020-12-09 02:54

i have a column ID and something like 1000 items, some of then were removed like id=90, id=127, id=326

how can i make a query to look for those availabl

7条回答
  •  [愿得一人]
    2020-12-09 03:11

    Do not reuse IDs. You usually have way enough available IDs so you don't have to care about fragmentation.

    For example, if you re-use IDs, links from search engines might point to something completely unrelated from whatever is in the search index - showing a "not found" error is much better in such a case.

提交回复
热议问题