Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1954

PK in decending order (1 reply)

$
0
0
Hello!
I'm a long time user of MyISAM-tables for a large website, and now we are experimenting with converting our tables to InnoDB.

Some of our largest tables (~180 million rows) currently have a PK that is negavite and decreasing for each new row (we mostly fetch rows in reverse insert-order, and back in the days when we started we used MySQL 3.23, and ORDER BY ... DESC was not optimized, so we had to make this trick for performance)

Now with InnoDB, will this cause any problems?
I think, if we use a "negative" primary key in an InnoDB-table and decrease it's value for each new insert, will this lead to performance issues for inserts?

As InnoDB will store the rows in PK order, I guess inserting new records with decreasing value for PK would cause InnoDB to always insert the rows in the beginning of the tablespace.
Will this have a huge impact on performance, and do you recommended us changing this to "normal increasing PK"?

We normally have quite many inserts during normal operation, but at the same time, the server will have plenty of RAM and these tables should fit in memory...

Thanks for any advice!
/Tobias

Viewing all articles
Browse latest Browse all 1954

Trending Articles