Don't include a from clause with the last_insert_id(), or you will get
a full table scan.
The last_insert_id will only give you the insert id for the last record
inserted.
mysql mailing list user wrote:
> Hi,
> I have a big problem with last_insert_id() query.
> I am addin
Hi,
I have a big problem with last_insert_id() query.
I am adding records to a table with about half a million records in it. The
insert takes well under a second. I then call last_insert_id as I need to
make a link to another table.
The last_insert_id takes around 2 minutes!!! Yes *minutes