<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Stored Function to generate Sequences</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/</link>
	<description>Percona&#039;s MySQL &#38; InnoDB performance and scalability blog</description>
	<lastBuildDate>Sat, 11 Feb 2012 16:45:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Silvio Delgado</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-777831</link>
		<dc:creator>Silvio Delgado</dc:creator>
		<pubDate>Thu, 14 Oct 2010 15:47:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-777831</guid>
		<description>Very good! It works fine!

Thanks a lot.</description>
		<content:encoded><![CDATA[<p>Very good! It works fine!</p>
<p>Thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Smith</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-777123</link>
		<dc:creator>David Smith</dc:creator>
		<pubDate>Thu, 07 Oct 2010 21:04:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-777123</guid>
		<description>Well, I see I&#039;m a little late to the party...

I&#039;m wondering if I can use something like this for two user classes sharing the same int table row, by auto-incrementing in ranges, e.g. user class one has user_id in the 0 - 1000 range, and user class two in the &gt; 1000 range.

The reason I would need to do this instead of just cresting another table for the new user class, is because I am attempting to modify an existing, and rather complicated (to me) php app.

What sort of syntax would I need to use, given that I want to modify transactions to/from an existing row rather than CREATE TABLE (as your example does)? I just want to write and filter on queries for user_id&#039;s from the two seperate ranges, and auto-increment new users of the two clases in their respective ranges.

Thanks!</description>
		<content:encoded><![CDATA[<p>Well, I see I&#8217;m a little late to the party&#8230;</p>
<p>I&#8217;m wondering if I can use something like this for two user classes sharing the same int table row, by auto-incrementing in ranges, e.g. user class one has user_id in the 0 &#8211; 1000 range, and user class two in the &gt; 1000 range.</p>
<p>The reason I would need to do this instead of just cresting another table for the new user class, is because I am attempting to modify an existing, and rather complicated (to me) php app.</p>
<p>What sort of syntax would I need to use, given that I want to modify transactions to/from an existing row rather than CREATE TABLE (as your example does)? I just want to write and filter on queries for user_id&#8217;s from the two seperate ranges, and auto-increment new users of the two clases in their respective ranges.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruno Braga</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-668321</link>
		<dc:creator>Bruno Braga</dc:creator>
		<pubDate>Sat, 24 Oct 2009 00:15:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-668321</guid>
		<description>Yeah, I did a stress testing on this, and worked fine (on InnoDB as well).</description>
		<content:encoded><![CDATA[<p>Yeah, I did a stress testing on this, and worked fine (on InnoDB as well).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baron Schwartz</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-668117</link>
		<dc:creator>Baron Schwartz</dc:creator>
		<pubDate>Fri, 23 Oct 2009 12:23:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-668117</guid>
		<description>MyISAM has table-level locking.  It works.</description>
		<content:encoded><![CDATA[<p>MyISAM has table-level locking.  It works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruno Braga</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-667566</link>
		<dc:creator>Bruno Braga</dc:creator>
		<pubDate>Thu, 22 Oct 2009 07:06:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-667566</guid>
		<description>This code does not handle concurrency/locking. Has anyone tested this against overloaded systems? I have the feeling it will not work properly.</description>
		<content:encoded><![CDATA[<p>This code does not handle concurrency/locking. Has anyone tested this against overloaded systems? I have the feeling it will not work properly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saroj</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-572044</link>
		<dc:creator>saroj</dc:creator>
		<pubDate>Tue, 02 Jun 2009 05:15:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-572044</guid>
		<description>thanks peter code worked</description>
		<content:encoded><![CDATA[<p>thanks peter code worked</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Using Multiple Sequences in a Table &#171; Everything MySQL</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-355572</link>
		<dc:creator>Using Multiple Sequences in a Table &#171; Everything MySQL</dc:creator>
		<pubDate>Tue, 16 Sep 2008 18:32:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-355572</guid>
		<description>[...] issues.Â  After lot of trials, debates and finally referring Planet MySQL, I went ahead with this suggestion by Peter from MySQL Performance Blog and some help from here. CREATE TABLE sequences ( event_id [...]</description>
		<content:encoded><![CDATA[<p>[...] issues.Â  After lot of trials, debates and finally referring Planet MySQL, I went ahead with this suggestion by Peter from MySQL Performance Blog and some help from here. CREATE TABLE sequences ( event_id [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin Huff</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-337671</link>
		<dc:creator>Justin Huff</dc:creator>
		<pubDate>Thu, 31 Jul 2008 01:22:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-337671</guid>
		<description>I typically see the update step written like:
UPDATE sequence SET nValue=last_insert_id(nValue+1) WHERE strName=?

I&#039;d like to allow servers the option of asking 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 &#039;last id handed out&#039; to &#039;the next id to hand out&#039;.  That way requesters don&#039;t need to know how big the last block was.

Am I missing something here? 
Thanks!</description>
		<content:encoded><![CDATA[<p>I typically see the update step written like:<br />
UPDATE sequence SET nValue=last_insert_id(nValue+1) WHERE strName=?</p>
<p>I&#8217;d like to allow servers the option of asking for more than one id per call by moving the increment step outside the last_insert_id:<br />
UPDATE sequence SET nValue=last_insert_id(nValue)+? WHERE strName=?</p>
<p>The value in the table shifts from being the &#8216;last id handed out&#8217; to &#8216;the next id to hand out&#8217;.  That way requesters don&#8217;t need to know how big the last block was.</p>
<p>Am I missing something here?<br />
Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Links for Wed 7 May 2008 - Joseph Scott&#8217;s Blog</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-296732</link>
		<dc:creator>Links for Wed 7 May 2008 - Joseph Scott&#8217;s Blog</dc:creator>
		<pubDate>Thu, 08 May 2008 16:52:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-296732</guid>
		<description>[...] Stored Function to generate Sequences &#124; MySQL Performance Blog - You could combine this with an INSERT trigger and get even more auto_increment like functionality.  Tags: database mysql sequence [...]</description>
		<content:encoded><![CDATA[<p>[...] Stored Function to generate Sequences | MySQL Performance Blog &#8211; You could combine this with an INSERT trigger and get even more auto_increment like functionality.  Tags: database mysql sequence [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/comment-page-1/#comment-265378</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Fri, 04 Apr 2008 01:41:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2008/04/02/stored-function-to-generate-sequences/#comment-265378</guid>
		<description>Arjen,

Indeed insert on dup key updates saves you from initialization though I&#039;m wondering what way would be the faster.
Though I guess there would not be any significant difference here.</description>
		<content:encoded><![CDATA[<p>Arjen,</p>
<p>Indeed insert on dup key updates saves you from initialization though I&#8217;m wondering what way would be the faster.<br />
Though I guess there would not be any significant difference here.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

