girish.kc Posted August 10, 2010 Share Posted August 10, 2010 Hi, I am planning to use a Master Slave setup in MySQL database. My concern is can I use the "mysql_insert_id()" function to get the recently inserted ID? Does it uses the "Select" query to get the latest inserted ID? In that case my query may fail because, the insert query will be fired at master DB, but the select to slave DB. And there may be some delay in the replication. Need help .. Link to comment https://forums.phpfreaks.com/topic/210317-mysql_insert_id-in-a-master-slave-setup/ Share on other sites More sharing options...
Mchl Posted August 10, 2010 Share Posted August 10, 2010 Yes you can use it. It uses MySQL's LAST_INSERT_ID() function, and as such is very reliable (as long as you know about it's limits as described in manual) Link to comment https://forums.phpfreaks.com/topic/210317-mysql_insert_id-in-a-master-slave-setup/#findComment-1097501 Share on other sites More sharing options...
fenway Posted August 10, 2010 Share Posted August 10, 2010 Yes you can use it. It uses MySQL's LAST_INSERT_ID() function, and as such is very reliable (as long as you know about it's limits as described in manual) The only reasonable "limit" being multi-valued insert statements. Link to comment https://forums.phpfreaks.com/topic/210317-mysql_insert_id-in-a-master-slave-setup/#findComment-1097556 Share on other sites More sharing options...
girish.kc Posted August 11, 2010 Author Share Posted August 11, 2010 Thanks for the replay Link to comment https://forums.phpfreaks.com/topic/210317-mysql_insert_id-in-a-master-slave-setup/#findComment-1097920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.