影响表创建持续时间的Mysql参数
我正在从 mysql 终端运行查询:
CREATE TABLE test(ID int, col1 id, col2 ID, PRIMARY KEY (ID) ENGINE = InnoDB;
使用 SHOW PROFILE 命令我得到平均:
创建表持续时间 = 0.008000,相当于大约 8 毫秒。
有什么建议可以在 mysql 配置中查看哪些参数来缩短表创建时间? 换句话说,哪些参数可以影响表创建时间。
我使用的是 Intel Xeon 3.80GHz 和 4Gb 内存。
I am running a query from mysql terminal:
CREATE TABLE test(ID int, col1 id, col2 ID, PRIMARY KEY (ID) ENGINE = InnoDB;
Using the SHOW PROFILE command I get an average of :
creating table duration = 0.008000 which equals to about 8ms.
Any suggestions what parameters to look in mysql configuration to improve table creation time?
In other words what parameters can affect the table creation time.
I am using a Intel Xeon 3.80GHz with 4Gb ram.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
以下是一些可能影响 CREATE TABLE 性能的变量:
总而言之,我认为 8 毫秒是可以的,但这是在不了解更多细节的情况下说的。
Here are some variables which might affect the
CREATE TABLE
-performance:All in all I'd say 8ms are ok, but thats said without knowing more details.
据我所知,在软件方面没有太多可以专门配置表创建的功能。硬件可能会有所帮助,如果可以的话,首先添加更多 RAM。但是,之前有一个堆栈问题可能会导致提供一些帮助。
As far as I know there is not much on the software side you can configure for table creation specifically. Hardware may help, start by adding more RAM if you can. However, there was a previous Stack question that may lend some assistance.
大多数参数取决于您使用的数据库引擎。假设它是 InnoDB(默认),请看一下
innodb_buffer_pool_size
和innodb_additional_mem_pool_size
话虽如此,我怀疑您能否在 8 毫秒的基础上看到如此大的改进。
Most of the parameters will depend on the database engine you are using. Assuming its InnoDB (the default), take a look at
innodb_buffer_pool_size
andinnodb_additional_mem_pool_size
That being said, I doubt you will be able to see that much improvement off of 8 ms.
如果创建表需要 8 毫秒对您来说是个问题,那么您的数据库设计很可能有问题(如果您想每秒创建一千个表,就会出现这种情况)。
如果您只是临时使用它们,请使用存储在内存中的表:
创建速度会更快,但是如果您的服务器崩溃,那么这些表中的数据就会丢失。
If it's a problem for you that a table creation requires 8 milliseconds then there is quite likely something wrong with your database design (that would be the case if you want to create a thousand tables per second).
If you are using them just temporary, use tables that are stored in memory:
Creation will be faster, however if your server crashes then the data in those tables is lost.