开发者

auto_increment value change affect performance in MySQL?

开发者 https://www.devze.com 2022-12-13 02:59 出处:网络
I have changed auto_increment value to 1000000 of a MyISAM table. Does this affect read/write perfor开发者_StackOverflow中文版mance? I thought that db engine may look for IDs before ID 1000000 everyti

I have changed auto_increment value to 1000000 of a MyISAM table. Does this affect read/write perfor开发者_StackOverflow中文版mance? I thought that db engine may look for IDs before ID 1000000 everytime a list of rows is requested.


This should not affect the read/write performance at all. Just by setting the auto_increment value to a high number does not mean that there is a huge gap between the rows.

Best wishes, Fabian


No, the value of an auto-increment ID (or any ID for that matter) will have no affect on performance.

The only consideration when picking values is when you will run out of IDs given the size of your ID column (the size of the column may have an impact but it's likely to be minor compared to other performance considerations).


No. ISAM means "Indexed Sequential Access Method" MyISAM is an extension to that mechanism. So basically the database builds a lookup table of the primary keys and where in the datafile its stored. Then it jumps to that spot in the file to read the data. The index itself a tree or similar structure to minimize the time needed to find the key. . . As others have mentioned, you'll have other performance concerns when using MyISAM.

0

精彩评论

暂无评论...
验证码 换一张
取 消