Subject Re: [firebird-support] Field Position - Does it matter?
Author Ann W. Harrison
Larry Hengen wrote:
>
> Does it matter what position in the table definition a foreignkey or
> varchar appears?

Not at all. The order of declaration and the "apparent" order are
independent. There's no particular reason - other than history - that
fields are stored in the order they're declared. One of the attributes
of a field is position. That attribute determines where the field shows
up in a "select * from <table>". At some point, as we get into making
changes to the ODS (on disk structure - the physical representation of
the database) we may store fields ordered by type and size for better
compression.
>
> For instance, if a varchar appears before a FK, and the varchar gets
> updated, what affect does that have on the indexes?

None. Neither does it matter if the fields in a compound key are
contiguous. Indexes are stored on their own pages, entirely separate
from data.
>
> Does column order matter at all?

If you're one of the lazy undisciplined (not that I have opinions on the
subject) programmers who use select * or insert without a field list,
the position matters a lot - if you forget it (or change it, or add a
field) your code stops working. If you're a forward thinking,
professional programmer (see above), the order doesn't matter at all.
>
>

Regards,


Ann