[development] schema API add column after

Ivan Sergio Borgonovo mail at webthatworks.it
Mon Jun 9 21:39:22 UTC 2008


On Mon, 09 Jun 2008 22:43:34 +0200 (CEST)
"Karoly Negyesi" <karoly at negyesi.net> wrote:

> > Make sense?
> 
> Nope. I try to refrain from being a maths egghead but SQL does not
> need or rely on column order.

+1 Relying on column order is generally considered bad design and
adding columns at a specified place is not supported on all DBs. I'm
not sure being able to add a column in a specified place is part of
the standard... but this doesn't make it a good design practice.
Supporting bad design that risk to break stuff for other DB doesn't
look as a good idea.

Relaying on column order is hard to maintain and it is always
accompanied by "select *" that may lead to very poor performances.

eg. you add a column there but you don't tell your co-developer, you
add a column there but you forget to add it to all your statements.
Result: all your code will break or your statement will return an
extra 20Kb of TEXT where it is not needed.
You explicitly name columns and there will be higher chances that:
a) your code will continue to work in most of the places
b) you'll spot the places where you've to change it easier

Once you support it in the API people will start to use it.

There *may* be performance improvements having fixed size columns at
the beginning of the table but this heavily depends on the
implementation and well... most of the times when you're looking for
performance improvements there... it is like to hope in extra boost
adding some more stickers to your Corolla.

Not all the times having one more weapon means being safer.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



More information about the development mailing list