 




<?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: What&#8217;s your fastest /&#8217;Unique number&#8217; issue method?</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/</link>
	<description></description>
	<lastBuildDate>Thu, 23 May 2013 20:47:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Featured Member: Kccrosser - ITKE Community Blog</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/#comment-94742</link>
		<dc:creator>Featured Member: Kccrosser - ITKE Community Blog</dc:creator>
		<pubDate>Thu, 28 Jul 2011 06:39:16 +0000</pubDate>
		<guid isPermaLink="false">#comment-94742</guid>
		<description><![CDATA[[...] What&#8217;s your fastest/&#8221;Unique number&#8221; issue method?  [...]]]></description>
		<content:encoded><![CDATA[<p>[...] What&#8217;s your fastest/&#8221;Unique number&#8221; issue method?  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bvining</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/#comment-94730</link>
		<dc:creator>bvining</dc:creator>
		<pubDate>Thu, 28 Jul 2011 00:09:13 +0000</pubDate>
		<guid isPermaLink="false">#comment-94730</guid>
		<description><![CDATA[8 microseconds is the granularity of the clock, BUT the system uses trailing bits in the 8-byte value to provide unique values within the 8 microsecond interval (8 microseconds only requires use of the first 48 bits, leaving lots of room for accesses within the same clock tick by incrementing the trailing bits). Some instructions do allow you to bypass this uniqueness quality, but by default the MI Reference has this to say:

The TOD clock machine facility guarantees that each request to materialize the value of the TOD clock will receive a unique, monotonically increasing value. (wiht a few qualifiers that you can find in the TOD discussion)

Bruce]]></description>
		<content:encoded><![CDATA[<p>8 microseconds is the granularity of the clock, BUT the system uses trailing bits in the 8-byte value to provide unique values within the 8 microsecond interval (8 microseconds only requires use of the first 48 bits, leaving lots of room for accesses within the same clock tick by incrementing the trailing bits). Some instructions do allow you to bypass this uniqueness quality, but by default the MI Reference has this to say:</p>
<p>The TOD clock machine facility guarantees that each request to materialize the value of the TOD clock will receive a unique, monotonically increasing value. (wiht a few qualifiers that you can find in the TOD discussion)</p>
<p>Bruce</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kccrosser</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/#comment-94716</link>
		<dc:creator>kccrosser</dc:creator>
		<pubDate>Wed, 27 Jul 2011 16:48:26 +0000</pubDate>
		<guid isPermaLink="false">#comment-94716</guid>
		<description><![CDATA[Obviously, if you are going to add 1-2 characters for system id, they should be appended to the right of the generated time component to ensure this is a good record key.
Re converting to base-36, I used that in a large system back in 1996 to generate a globally unique 16-character id, where I needed to handle concurrent id generations from 1000+ independent workstations per system.

If you are looking at an 8 millisecond window, that is actually a LONG time.  I would be sure to detect duplicates, and probably use the two characters to hold both a system id and a collision sequence counter to ensure uniqueness.

Personally, I would still go with a SQL sequence number and append a system id.  SQL can generate and track sequence numbers in microseconds - much less time than the 8 millisecond window you mention.]]></description>
		<content:encoded><![CDATA[<p>Obviously, if you are going to add 1-2 characters for system id, they should be appended to the right of the generated time component to ensure this is a good record key.<br />
Re converting to base-36, I used that in a large system back in 1996 to generate a globally unique 16-character id, where I needed to handle concurrent id generations from 1000+ independent workstations per system.</p>
<p>If you are looking at an 8 millisecond window, that is actually a LONG time.  I would be sure to detect duplicates, and probably use the two characters to hold both a system id and a collision sequence counter to ensure uniqueness.</p>
<p>Personally, I would still go with a SQL sequence number and append a system id.  SQL can generate and track sequence numbers in microseconds &#8211; much less time than the 8 millisecond window you mention.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yorkshireman</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/#comment-94696</link>
		<dc:creator>yorkshireman</dc:creator>
		<pubDate>Wed, 27 Jul 2011 08:18:08 +0000</pubDate>
		<guid isPermaLink="false">#comment-94696</guid>
		<description><![CDATA[Thanks for all these, chaps.  Great suggestions, and it all happens whilst I&#039;m asleep! 

responding to some of the issues raised.
Fastest - for the job requesting the ID.  Multiple interactive jobs of course, so the &#039;conventional&#039; standby of read a record, update it, write it back.  is exremely suspect - though there are many, many incarnations on site here. 
Unique is the main concern - and across systems, should objects be repatriated, or processing moved to share different boxes.  Sequential woudl be useful, but if someone wants to know sequence, I say &quot;let them examine the system creation date&quot; 

The 10 bytes is a backward compatibility thing, and though I can see a way to engineer it out, it needs radical re architecting to do so, and you all know the cost/benefit / test issues that come with &#039;radical&#039;

&#039;Tricky home brew&#039; - hate the stuff.  (I have some in may past - haven&#039;t we all?)  packing a sequential number down into hex or better would be as far as I&#039;d consider.  Given there are 256 characters to a byte, then 2 bytes can represent 256x256 = 65000 values.  Realistically, we probably want to restrict to alphanumerics so a radix 36 is OK, and 62 if we use lower case, but there are other implications in doing this kind of stuff (speed of translation being one) 

GENUID - Having someone else work it out is good, but I see infrastucture issues using this approach, as the companents need to be accessable - quote &quot;Restart the Platform Agent and the IBM Systems Director agent, if installed.&quot; 

So MI instructions for me -= thanks Bruce.  The 8 microsecond granularity will just have to be a restriction.  But speed of execution shoudl be like lightning.  If this becomes a problem, then I&#039;ll have to go with encoding the date/time into something other than hex. 
At the end of the day, any routine like this should really acknowledge the possibility of two jobs making a request within the same 8 milliseconds - even though the processing is modestly complex, the ID requests could collide, so a &#039;uniqueness test&#039; may be needed within the routine.  &#039; has time moved on yet?&#039;


Excellent suggestions. 
I feel I should return the eventual code to some forum somewhere..]]></description>
		<content:encoded><![CDATA[<p>Thanks for all these, chaps.  Great suggestions, and it all happens whilst I&#8217;m asleep! </p>
<p>responding to some of the issues raised.<br />
Fastest &#8211; for the job requesting the ID.  Multiple interactive jobs of course, so the &#8216;conventional&#8217; standby of read a record, update it, write it back.  is exremely suspect &#8211; though there are many, many incarnations on site here.<br />
Unique is the main concern &#8211; and across systems, should objects be repatriated, or processing moved to share different boxes.  Sequential woudl be useful, but if someone wants to know sequence, I say &#8220;let them examine the system creation date&#8221; </p>
<p>The 10 bytes is a backward compatibility thing, and though I can see a way to engineer it out, it needs radical re architecting to do so, and you all know the cost/benefit / test issues that come with &#8216;radical&#8217;</p>
<p>&#8216;Tricky home brew&#8217; &#8211; hate the stuff.  (I have some in may past &#8211; haven&#8217;t we all?)  packing a sequential number down into hex or better would be as far as I&#8217;d consider.  Given there are 256 characters to a byte, then 2 bytes can represent 256&#215;256 = 65000 values.  Realistically, we probably want to restrict to alphanumerics so a radix 36 is OK, and 62 if we use lower case, but there are other implications in doing this kind of stuff (speed of translation being one) </p>
<p>GENUID &#8211; Having someone else work it out is good, but I see infrastucture issues using this approach, as the companents need to be accessable &#8211; quote &#8220;Restart the Platform Agent and the IBM Systems Director agent, if installed.&#8221; </p>
<p>So MI instructions for me -= thanks Bruce.  The 8 microsecond granularity will just have to be a restriction.  But speed of execution shoudl be like lightning.  If this becomes a problem, then I&#8217;ll have to go with encoding the date/time into something other than hex.<br />
At the end of the day, any routine like this should really acknowledge the possibility of two jobs making a request within the same 8 milliseconds &#8211; even though the processing is modestly complex, the ID requests could collide, so a &#8216;uniqueness test&#8217; may be needed within the routine.  &#8216; has time moved on yet?&#8217;</p>
<p>Excellent suggestions.<br />
I feel I should return the eventual code to some forum somewhere..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bvining</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/#comment-94685</link>
		<dc:creator>bvining</dc:creator>
		<pubDate>Tue, 26 Jul 2011 23:36:06 +0000</pubDate>
		<guid isPermaLink="false">#comment-94685</guid>
		<description><![CDATA[If you&#039;re looking for a fast sequential value, consider an 8-byte integer stored in a *USRSPC. Access the *USRSPC location by pointer and use the &lt;a href=&quot;http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzatk/CMPSW.htm&quot;&gt;Compare and Swap MI instruction&lt;/a&gt; to provide access control.

If there&#039;s no need for sequential values, consider using the &lt;a href=&quot;http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzatk/MATMDATA.htm&quot;&gt;Materialize Machine Data MI instruction&lt;/a&gt; with option x&#039;0004&#039;. The time of day returned will be a unique value for the next 60 or so years and, using UTC, avoids any DST concerns related to local time being set back.

Both approaches need 8 bytes, leaving you 2 bytes for system identification.]]></description>
		<content:encoded><![CDATA[<p>If you&#8217;re looking for a fast sequential value, consider an 8-byte integer stored in a *USRSPC. Access the *USRSPC location by pointer and use the <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzatk/CMPSW.htm">Compare and Swap MI instruction</a> to provide access control.</p>
<p>If there&#8217;s no need for sequential values, consider using the <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzatk/MATMDATA.htm">Materialize Machine Data MI instruction</a> with option x&#8217;0004&#8242;. The time of day returned will be a unique value for the next 60 or so years and, using UTC, avoids any DST concerns related to local time being set back.</p>
<p>Both approaches need 8 bytes, leaving you 2 bytes for system identification.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/#comment-94678</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 26 Jul 2011 20:23:39 +0000</pubDate>
		<guid isPermaLink="false">#comment-94678</guid>
		<description><![CDATA[&lt;i&gt;if it wasn’t for the 10 bytes limitation...&lt;/i&gt;

That was the same problem I saw. The GENUUID function is quick and (technically) guaranteed unique &quot;across all time and space&quot; (whatever that means).

Then again, some of those bytes identify the system/hardware that the API runs on. Maybe it&#039;s time to dig into the format of the UUID to see if six bytes can simply be discarded -- if it&#039;s never important to separate UUIDs by system thereby opening the possibility of duplicating &quot;unique&quot; numbers on two different systems.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>if it wasn’t for the 10 bytes limitation&#8230;</i></p>
<p>That was the same problem I saw. The GENUUID function is quick and (technically) guaranteed unique &#8220;across all time and space&#8221; (whatever that means).</p>
<p>Then again, some of those bytes identify the system/hardware that the API runs on. Maybe it&#8217;s time to dig into the format of the UUID to see if six bytes can simply be discarded &#8212; if it&#8217;s never important to separate UUIDs by system thereby opening the possibility of duplicating &#8220;unique&#8221; numbers on two different systems.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kccrosser</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/#comment-94675</link>
		<dc:creator>kccrosser</dc:creator>
		<pubDate>Tue, 26 Jul 2011 19:46:47 +0000</pubDate>
		<guid isPermaLink="false">#comment-94675</guid>
		<description><![CDATA[I agree with Tom Liotta - use a DB generated sequence number.  By caching block values, this can be very fast.

Beware of using some tricky home-brew if you are thinking this will be a database key for searching/linking records.  It is too easy to generate IDs that &quot;clump&quot; badly and cause database query optimizers to give up and do table scans.  Pure integer sequence numbers usually work best.

If you do create your own, think about what a histogram of the resulting values might look like.  If it would plot very flat horizontally, great.  If you see a bunch of very tall spikes, your query optimizer is probably going to hate that as a possible index.]]></description>
		<content:encoded><![CDATA[<p>I agree with Tom Liotta &#8211; use a DB generated sequence number.  By caching block values, this can be very fast.</p>
<p>Beware of using some tricky home-brew if you are thinking this will be a database key for searching/linking records.  It is too easy to generate IDs that &#8220;clump&#8221; badly and cause database query optimizers to give up and do table scans.  Pure integer sequence numbers usually work best.</p>
<p>If you do create your own, think about what a histogram of the resulting values might look like.  If it would plot very flat horizontally, great.  If you see a bunch of very tall spikes, your query optimizer is probably going to hate that as a possible index.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bigkat</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/#comment-94661</link>
		<dc:creator>bigkat</dc:creator>
		<pubDate>Tue, 26 Jul 2011 15:18:02 +0000</pubDate>
		<guid isPermaLink="false">#comment-94661</guid>
		<description><![CDATA[if it wasn&#039;t for the 10 bytes limitation I&#039;d be tempted to use the _GENUUID MI api (it needs 16 bytes though)]]></description>
		<content:encoded><![CDATA[<p>if it wasn&#8217;t for the 10 bytes limitation I&#8217;d be tempted to use the _GENUUID MI api (it needs 16 bytes though)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/whats-your-fastest-unique-number-issue-method/#comment-94635</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 26 Jul 2011 06:17:27 +0000</pubDate>
		<guid isPermaLink="false">#comment-94635</guid>
		<description><![CDATA[&quot;Fastest&quot; is tricky. Fastest for a single job? Fastest for many jobs in the same application? Since you discuss locks, it has to be across multiple jobs. And are you simply interested in &quot;unique&quot; or do you think sequential is required? (Sequential for a single job? Does it &lt;b&gt;have to be&lt;/b&gt; sequential across multiple jobs or would that just be nicer if it was?)

Nowadays, I&#039;d probably just use a SQL sequence object and let the system take care of everything. See &lt;a href=&quot;http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=/sqlp/rbafysequence.htm&quot;&gt;Creating and using sequences&lt;/a&gt; for a basic discussion. DB2 can cache a block of values to make a series available to a job to help speed generation.

Tom]]></description>
		<content:encoded><![CDATA[<p>&#8220;Fastest&#8221; is tricky. Fastest for a single job? Fastest for many jobs in the same application? Since you discuss locks, it has to be across multiple jobs. And are you simply interested in &#8220;unique&#8221; or do you think sequential is required? (Sequential for a single job? Does it <b>have to be</b> sequential across multiple jobs or would that just be nicer if it was?)</p>
<p>Nowadays, I&#8217;d probably just use a SQL sequence object and let the system take care of everything. See <a href="http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=/sqlp/rbafysequence.htm">Creating and using sequences</a> for a basic discussion. DB2 can cache a block of values to make a series available to a job to help speed generation.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.017 seconds using memcached
Object Caching 380/383 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-23 22:50:48 -->