<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1028512" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1028512</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/phpmysql-autoindex-deletes#comment-1167995</link>
    <description> &lt;p&gt;Well, the auto increment of the primary key is ment to be and is unique in the first place, I still don&#039;t understand why you&#039;d want to do what you want to do... :S&lt;/p&gt;
 </description>
     <pubDate>Wed, 16 Mar 2005 09:01:54 +0000</pubDate>
 <dc:creator>Renegade</dc:creator>
 <guid isPermaLink="false">comment 1167995 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/phpmysql-autoindex-deletes#comment-1167967</link>
    <description> &lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;It&#039;s probably just my nature to try and keep everything in order.   &lt;/p&gt;
&lt;p&gt;Having the numbers jump around just makes it harder to look at...and so if there is a problem in the code you might not notice it because your brain is expecting to see &quot;random&quot; numbers.  I find that by keeping a tight sequential order on indexes (particularly during development phase), I can spot problems immediately - PLUS, everything looks &quot;great&quot; over the lifetime of the data...&lt;/p&gt;
&lt;p&gt;I know the database is doing it for a good reason - that&#039;s how it ensures that each index is 100% unique (by never ever repeating one).  Typical of machines - they do exactly what is required, but not necessarily in an intuitive way that humans relate to...&lt;/p&gt;
&lt;p&gt;I think I&#039;ll try using the Alter Table after deletes and see if it causes any grief...&lt;/p&gt;
&lt;p&gt;Mij&lt;/p&gt;
 </description>
     <pubDate>Tue, 15 Mar 2005 23:03:42 +0000</pubDate>
 <dc:creator>mijator</dc:creator>
 <guid isPermaLink="false">comment 1167967 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/phpmysql-autoindex-deletes#comment-1167961</link>
    <description> &lt;p&gt;alter table works the same way as I described, wouldn&#039;t do to text file though as it could get corrupt.&lt;/p&gt;
&lt;p&gt;Only reason not to is security and resources, also if your table is being &#039;reordered&#039; and someone tries to access the data at the same time will create an error as it wont be there.&lt;/p&gt;
&lt;p&gt;You also said &lt;strong&gt;and is particularly confusing to maintain if that same index is a foreign key in another table...&lt;/strong&gt;, if you change the autoindex numbers wont match on other tables, you could change them as well but could end up very messy&lt;/p&gt;
 </description>
     <pubDate>Tue, 15 Mar 2005 20:26:23 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1167961 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/phpmysql-autoindex-deletes#comment-1167948</link>
    <description> &lt;p&gt;I have to admit, I&#039;m not really understanding why it&#039;s a problem that the table jumps around. As I understand it, that&#039;s the standard way for an auto-incrementing index to work.&lt;/p&gt;
&lt;p&gt;What&#039;s confusing about it? (Honest question, no sarcasm intended.)&lt;/p&gt;
 </description>
     <pubDate>Tue, 15 Mar 2005 17:13:25 +0000</pubDate>
 <dc:creator>timjpriebe</dc:creator>
 <guid isPermaLink="false">comment 1167948 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/phpmysql-autoindex-deletes#comment-1167943</link>
    <description> &lt;p&gt;Reading through the MySQL documentation, I found this:&lt;/p&gt;
&lt;p&gt;*****&lt;br /&gt;
ALTER TABLE tbl_name TYPE=InnoDB&lt;/p&gt;
&lt;p&gt;That causes MySQL to rebuild the table. Another way to perform a defragmention operation is to use mysqldump to dump the table to a text file, drop the table, and reload it from the dump file. &lt;/p&gt;
&lt;p&gt;*****&lt;br /&gt;
I tried the first idea (i.e., Alter table) and it appears to have worked!  I can see myself adding that statement after each delete, which should prevent the index/autoindex from becoming fragmented in the first place...&lt;/p&gt;
&lt;p&gt;Can anyone think of a reason why I wouldn&#039;t want to run the Alter table command each time?&lt;/p&gt;
&lt;p&gt;Thx,&lt;/p&gt;
&lt;p&gt;Mij&lt;/p&gt;
 </description>
     <pubDate>Tue, 15 Mar 2005 16:08:19 +0000</pubDate>
 <dc:creator>mijator</dc:creator>
 <guid isPermaLink="false">comment 1167943 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>But it works using phpMyAdmin...</title>
    <link>https://www.webmaster-forums.net/web-database-development/phpmysql-autoindex-deletes#comment-1167941</link>
    <description> &lt;p&gt;I&#039;m not getting any errors - this is a data maintenance issue - i.e., the goal is to prevent the database from getting messy so that later on I can view it quickly without headaches...&lt;/p&gt;
&lt;p&gt;I really don&#039;t like the idea of having to remove all the data in a table and then rebuild it each time a delete happens....&lt;/p&gt;
&lt;p&gt;I&#039;ve noticed that when I use the phpMyAdmin defrag function, it resets the autoindex no problem...I&#039;d have thought a flush command or something would achieve this...&lt;/p&gt;
&lt;p&gt;Surely there&#039;s a way to defrag a table after a delete occurs?  How does phpMyAdmin do it?&lt;/p&gt;
&lt;p&gt;Thx,&lt;/p&gt;
&lt;p&gt;Mij&lt;/p&gt;
 </description>
     <pubDate>Tue, 15 Mar 2005 15:37:41 +0000</pubDate>
 <dc:creator>mijator</dc:creator>
 <guid isPermaLink="false">comment 1167941 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/phpmysql-autoindex-deletes#comment-1167891</link>
    <description> &lt;p&gt;You can&#039;t, the only way is to reinstall the data when you delete something.&lt;br /&gt;
delete the item, then pull all the data out into an array and then put it all back again (without the index numbers).&lt;/p&gt;
&lt;p&gt;If you are referencing table a with table b, index # then really all of the index # should be removed - depending on your data structure, but either way if you are referencing something that isn&#039;t there you wont get any results, if you are getting mysql errors then you need to adjust your code, the cheat way (using @ infront of the query) or the proper way (display a message saying no results or whatever)&lt;/p&gt;
 </description>
     <pubDate>Mon, 14 Mar 2005 21:11:31 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1167891 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
