[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



I stand corrected. I just tested this and found the following results:
Manually setting AUTO_INCREMENT to a value lower than the highest in
actual use will result in the value being changed by the system as soon
as it is access next.

So I found this by creating a test db with 2 columns, id
(auto_increment) and name. I stated with id=1. I then inserted values
for name and ran the counter in id up to 6. Then I set the
AUTO_INCREMENT value to 3. On the next insert, the AUTO_INCREMENT jumped
up to 8, the new row had a value of 7.

So the system does a MAX on the column and only store the AUTO_INCREMENT
value as a perk.

Now if I changed the value to one higher than currently in use, it kept
it and used it. But when I reset it back to a lower value (in
particular, one that had been skipped) it reset to the MAX+1 value as
earlier.
> 
> -G
> 
> On 9/14/05, Christopher Fowler <cfowler at outpostsentinel.com> wrote:
> > On Wed, 2005-09-14 at 21:34 -0400, George Carless wrote:
> > > ALTER TABLE theTableInQuestion AUTO_INCREMENT=1234
> > >
> > 
> > Here is a question.  Lets say that I have a bunch of holes because I
> > deleted various rows.  can I set the value to 1 and MySQL will be smart
> > enough to fill those holes?
> _______________________________________________
> Ale mailing list
> Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
-- 
James P. Kinney III          \Changing the mobile computing world/
CEO &amp; Director of Engineering \          one Linux user         /
Local Net Solutions,LLC        \           at a time.          /
770-493-8244                    \.___________________________./
<a  rel="nofollow" href="http://www.localnetsolutions.com";>http://www.localnetsolutions.com</a>

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
&lt;jkinney at localnetsolutions.com&gt;
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part



</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00298" href="msg00298.html">[ale] Auto increment in MySQL</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00301" href="msg00301.html">[ale] Auto increment in MySQL</a></strong>
<ul><li><em>From:</em> james.sumners at gmail.com (James Sumners)</li></ul></li>
<li><strong><a name="00303" href="msg00303.html">[ale] Auto increment in MySQL</a></strong>
<ul><li><em>From:</em> kafka at antichri.st (George Carless)</li></ul></li>
<li><strong><a name="00306" href="msg00306.html">[ale] Auto increment in MySQL</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00308" href="msg00308.html">[ale] Auto increment in MySQL</a></strong>
<ul><li><em>From:</em> me at grantrobertson.com (Grant Robertson)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00309.html">[ale] Auto increment in MySQL</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00311.html">[ale] Auto increment in MySQL</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00308.html">[ale] Auto increment in MySQL</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00309.html">[ale] Auto increment in MySQL</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00310"><strong>Date</strong></a></li>
<li><a href="threads.html#00310"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>