On Mon, Jun 9, 2008 at 4:43 PM, Karoly Negyesi &lt;<a href="mailto:karoly@negyesi.net">karoly@negyesi.net</a>&gt; wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; Make sense?<br>
<br>
Nope. I try to refrain from being a maths egghead but SQL does not need or rely on column order.<br>
</blockquote><div><br>Agreed.<br><br>If you are saying:<br><br>INSERT INTO tablename VALUES (&#39;a&#39;, 1, 2, 3, &#39;b&#39;);<br><br>Instead of <br><br>INSERT INTO tablename (col1, col4, col2, col5, col3) VALUES (&#39;a&#39;, 1, 2, 3, &#39;b&#39;);<br>
<br>Then you should change the former to the latter for maintenance&#39;s sake.<br><br>(If you are coding for Drupal 6, better use drupal_write_record() anyways).<br><br>But, there is a good reason to be able to control the column order: performance.<br>
<br>If you have numeric or short columns following varchar or text columns, MySQL has to work more if you do a WHERE on the short columns vs. if the shorter and numeric columns are before the text columns.<br><br>So, yes, don&#39;t rely on column positions from the programming point of view, but from a DBA point of you, they can make a difference. In fact NOT relying on the order when coding makes the life of a DBA easier, since he can move columns around as needed, without breaking code, whereas it would be impossible to do so if the code relies on position.<br>
</div></div>-- <br>Khalid M. Baheyeldin<br><a href="http://2bits.com">2bits.com</a>, Inc.<br><a href="http://2bits.com">http://2bits.com</a><br>Drupal optimization, development, customization and consulting.