为什么会有 2.5 亿条数据
运营需求,需要提供查询用户登录的记录。
我一思索,这简单呀,就设计了如下的数据表。
desc login_record;
+-------------+------------------+------+-----+-------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+-------------------+-------+
| user_id | int(10) unsigned | NO | MUL | NULL | |
| ip | varchar(40) | YES | | | |
| device_mark | varchar(500) | NO | | | |
| time | timestamp | NO | MUL | CURRENT_TIMESTAMP | |
+-------------+------------------+------+-----+-------------------+-------+