跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[问与答] mysql,如果数据会删除老数据,只保留最新数据,主键用 uuid 是否也 ok?

发表于

关于 mysql 主键,都说不建议用 uuid ,主要原因是耗费 16k 主键空间,怕容易撑爆。 但如果这个表只用于记录最新数据,定期删除老数据,比如:

1 、记录用户登录 session ,已经过期的 session 会定期删掉; 2 、记录自然日内的用户操作次数,比如用户发送短信验证码的次数,当天首次发验证码就产生一行数据用于记录当天发已经发送几次验证码,超额就拒绝发送,但到晚上 12 点就会清空这个表。

这两种情况下,是用 uuid 作为主键是否没啥问题?还是说还有我没想到的地方?

谢谢!

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.