May 24, 2012

Post: Statement based replication with Stored Functions, Triggers and Events

id 1 end_log_pos 1245 Intvar SET LAST_INSERT_ID=2/*!*/; #111214 0:04:50 server id 1 end_log_pos 1273 Intvar SET INSERT_ID=3/*!*/; #111214 0:04:50 server id…=1323817490/*!*/; INSERT INTO y (value) VALUES(LAST_INSERT_ID()) That was for a insert with only one value. What is the behavior if we insert multiple…

Post: Flexviews - part 3 - improving query performance using materialized views

…_id, customer_name, sale_when; $ php convert.php demo < sales.sql CALL flexviews.create('demo', 'dashboard_customer_sales', 'INCREMENTAL'); SET @mvid := LAST_INSERT_ID(); CALL flexviews.add_expr(@mvid,’GROUP’,'customer_id‘,’customer_id‘); CALL flexviews.add_expr(@mvid,’GROUP…

Post: Ultimate MySQL variable and status reference list

…_key_writeblogpercona.commanual Delayed_errorsblogpercona.commanual delayed_insert_limitblogpercona.commanual Delayed_insert_threadsblogpercona.commanual delayed_insert_timeoutblogpercona.commanual delayed_queue_sizeblogpercona.commanual Delayed…_supportblogpercona.commanual large_page_sizeblogpercona.commanual large_pagesblogpercona.commanual last_insert_idblogpercona.commanual Last_query_costblogpercona.commanual lc_messagesblogpercona.commanual lc_messages_dirblogpercona…

Comment: Stored Function to generate Sequences

… for more than one id per call by moving the increment step outside the last_insert_id: UPDATE sequence SET nValue=last_insert_id(nValue)+? WHERE strName=? The value in the table shifts from being the ‘last id handed out…

Post: Stored Function to generate Sequences

…)) returns int begin update seq set val=last_insert_id(val+1) where name=seq_name; return last_insert_id(); end // delimiter ; CREATE TABLE `seq` ( `name… code it seems to confuse a lot of people because last_insert_id() is used rather unusual way – with argument. This way of… when Insert is happening in the table with auto_increment values. It is also helpful if you need to decouple ID generation…

Comment: INSERT ON DUPLICATE KEY UPDATE and summary counters.

I’m trying to use this on INSERT SELECT statement and im getting an error. my sql is something like this INSERT INTO table SELECT * FROM table WHERE id=’2′ ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID() + 1 I use LAST_INSERT_ID() coz im using auto increment.

Comment: Sharing an auto_increment value across multiple MySQL tables

Another solution is to issue: UPDATE option1 SET id = LAST_INSERT_ID(id+1); New id is then available with mysql_insert_id API call.

Comment: Product to try: MySQL/MariaDB-Galera 0.8

… commit you could do something like last_transaction_id() (think like last_insert_id()), and you could then pass that id with your next select, telling… that you only want to read data when that transaction id was applied. Of course if the application thread keeps the…

Comment: Sharing an auto_increment value across multiple MySQL tables

http://code.flickr.com/blog/2010/02/08/ticket-servers-distributed-unique-primary-keys-on-the-cheap/ Flickr’s ticket servers use REPLACE INTO and LAST_INSERT_ID to do this same thing.

Comment: Cache Performance Comparison

For read-only data per page, you should use persist. If you need write data, you can lose some data, because, all pages have one connection, and share “last_inserted_id“, locks and etc. Sorry for my bad english