简体   繁体   English

SQL中的大量数据应该使用什么方法存储?

[英]What method should I use to store large amount of data in SQL?

I want to store game Inventory information into SQL.我想将游戏库存信息存储到 SQL 中。

What method should I use to best benefit performance costs?我应该使用什么方法来最大程度地提高绩效成本?

The data I want to store is:我要存储的数据是:

  • Slot ID (from 0 to 608);插槽 ID (从 0 到 608);
  • Item ID (from 0 to 66000);项目 ID (从 0 到 66000);

I can think about 2 ideas:我可以考虑2个想法:

  • Using " ; " separators, and all 608 Items goes into 1 column...使用“ ; ”分隔符,所有608 项进入 1 列...
UserID   | Items
---------+-----------
70001    | 3001 ;10000;65001;...
70002    | 0    ;0    ;0    ;...
70003    | 1    ;0    ;10   ;...
  • Or new Table for each user (UserID + Inv) where I can store like this:或者每个用户的新表(UserID + Inv) ,我可以像这样存储:
table: 70001Inv

SlotID    | ItemID
----------+-----------
000       | 3001
001       | 10000
002       | 65001

The third method is probably the best method.第三种方法可能是最好的方法。 . . . . a single table with three columns:具有三列的单个表:

UserID  | SlotID  | ItemID
--------+---------+-------
XXX     | 000     | 3001
XXX     | 001     | 0
XXX     | 002     | 65001

That is, the UserID is stored in the table, with a separate row for each combination.也就是说,UserID 存储在表中,每个组合都有一个单独的行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MySQL-我应使用哪种数据类型存储一组字符串 - MySQL - what data type should i use to store a set of strings MySQL - 我应该使用什么数据类型来存储 Map 字段 - MySQL - What data type should I use to store a Map field 我应该使用哪种数据库模型来存储此数据格式? - What Database model should I use to store this data format? 我应该使用什么数据类型在 mysql 数据库中存储电子邮件? - what data type should i use to store email in mysql database? 我应该如何通过nodejs将大量数据导入mysql? - How should I import a large amount of data to mysql via nodejs? 我无法在包含大量文本的Django模型字段上使用索引。 我正在使用MySQL。 我该怎么办? - I am not able to use indexing on Django model field which contains large amount of text. I am using MySQL. What should I do? 我应该使用哪种列数据类型来存储大量文本或 html - What column data type should I use for storing large amounts of text or html Laravel数据库,我应该使用哪种数据类型存储ID数组? - Laravel database, what data type should I use to store an array of IDs? 我应该使用哪种MYSQL数据类型来存储64位双精度? - What MYSQL data type should I use to store 64-bit double precision? Laravel 数据库,我应该使用什么数据类型来存储护照号码? - Laravel database, what data type should I use to store a passport number?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM