MySQL Forums
Forum List  »  General

Reserving primary keys
Posted by: Ronald Melo
Date: November 07, 2006 10:43AM

Hi.

I currently have a system that generates a big number of inserts, what I've been doing is creating a file and then loading it via LOAD DATA INFILE...
In the beggining of the process I have to reserve a number of primary keys for one table, which i was doing by locking the table for writes, searching for the max value for a key, and then putting the autoincrement (ALTER TABLE xxx AUTOINCREMENT = xxx) value for the table in that value plus the number of records I was going to generate.

The problem is that when the table has a decent amount of records the autoincrement change seems to be pretty slow, and since the table is locked for writing in that time, it really hurts the rest of the aplication... any ideas on how to solve this? is there another way to reserve the keys value other than changing the autoincrement value for the table?

Thanxs in advance....

Ronald.

Options: ReplyQuote


Subject
Written By
Posted
Reserving primary keys
November 07, 2006 10:43AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.