Bug #2806 | Different time on LAST_INSERT_ID and mysql_insert_id | ||
---|---|---|---|
Submitted: | 15 Feb 2004 9:10 | Modified: | 16 Feb 2004 1:28 |
Reporter: | Marcin Giedz | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.0.18 | OS: | Linux (Linux 2.4.24 Debian) |
Assigned to: | CPU Architecture: | Any |
[15 Feb 2004 9:10]
Marcin Giedz
[16 Feb 2004 1:23]
Alexander Keremidarski
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.mysql.com/documentation/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php Additional info: This is expected because of a way you are using LAST_INSERT_ID(); SELECT LAST_INSERT_ID() FROM table; You select as much rows as there are in table at the moment. I.e. at each iteration you select "a" rows for (a = 1; a < 100000; a++) INSERT .. 1 row .. SELECT LAST_INSERT_ID() FROM table; -> rows == a
[16 Feb 2004 1:28]
Alexander Keremidarski
Forgot to mention that with appropriate query: sprintf(query,"SELECT LAST_INSERT_ID()"); I got 100k rows inserted in 25 sec compared to 15 sec without LAST_INSERT_ID part. I hope you will agree this is expected difference.