<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:PMingLiU;
        panose-1:2 2 3 0 0 0 0 0 0 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@PMingLiU";
        panose-1:2 2 3 0 0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:299071611;
        mso-list-type:hybrid;
        mso-list-template-ids:-272071168 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I have implemented random_id generation
which solves 2 problems:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>(Link to explination: <a
href="http://earnestberry.com/node/13">http://earnestberry.com/node/13</a> )<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<ol style='margin-top:0in' start=1 type=1>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo1'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>Tables
     are NEVER locked when generating an id<o:p></o:p></span></font></li>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo1'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>ID,
     and there fore node (and id) generation is MUCH faster<o:p></o:p></span></font></li>
 <li class=MsoNormal style='color:navy;mso-list:l0 level1 lfo1'><font size=2
     color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial'>It
     is non-sequential, so no issues with the sequencing getting out of sync.<o:p></o:p></span></font></li>
</ol>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>The only draw back is on the DB side&#8230;if
you&#8217;re writing stored procedures, you don&#8217;t have a sequence or
counter table to look at. However, one can easily solve this by implementing
the methodology in a sp (stored-proc).<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
development-bounces@drupal.org [mailto:development-bounces@drupal.org] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Amr Mostafa<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, April 25, 2007
11:21 AM<br>
<b><span style='font-weight:bold'>To:</span></b> development@drupal.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [development] Why do
we avoid auto-incrementing db columns?</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>I believe one of the
reasons is that many times you want to know the ID of your new record. For
example, you inserted a new file to the 'files' table, and you would like to
store a reference to it in your xyz table. <br>
<br>
For mysql there is mysql_insert_id(), but not for others.<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal><span class=gmailquote><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>On 4/25/07, <b><span style='font-weight:bold'>Syscrusher</span></b>
&lt;<a href="mailto:syscrusher@4th.com">syscrusher@4th.com</a> &gt; wrote:</span></font></span><o:p></o:p></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Wednesday 25 April 2007 10:29, Ezra B. Gildesgame wrote:<br>
&gt; I happened to discuss this with Greg Knaddison yesterday. <br>
&gt; MySQL 4 does not support auto-incrementing columns.<br>
<br>
I must respectfully disagree. I happened to have a copy of the MySQL<br>
reference book from version 3.22 sitting on my bookshelf, and AUTO_INCREMENT<br>
was supported even then. :-) Never mind the question of why I still have such <br>
an old book....<br>
<br>
I also checked a PostgreSQL reference book, and they offer a SERIAL<br>
column type that works very similarly to the AUTO_INCREMENT in MySQL. I don't<br>
know how far back this support goes; my book is for PG version 8.something and<br>
was copyright 2006.<br>
<br>
I can't comment on the Microsoft SQL Server implementation of this, if any,<br>
because I don't have any manual for that here.<br>
<br>
Scott<br>
<br>
--<br>
-------------------------------------------------------------------------------
<br>
Syscrusher (Scott
Courtney)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Drupal
page:&nbsp;&nbsp; <a href="http://drupal.org/user/9184">http://drupal.org/user/9184</a><br>
syscrusher at 4th dot
com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Home
page:&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://4th.com/">http://4th.com/ </a><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>