[plug] auto-increment in mysql

Hook hooker at iinet.net.au
Thu Jan 2 07:53:06 WST 2003


I think I expressed myself badly - I was disagreeing with the "indexes are
unique fields in a table - and cannot in any way be duplicated". They
certainly *can* be unique and it's often valuable to have a guaranteed
unique identity in a table, but the "..cannot in any way.." comment is just
plain wrong.

Sorry for the confusion.

The Hooker


Jon Miller wrote:
> In my experience in programming databases many moons ago (I'm talking
> DOS base systems of the early 80's) We were told to use Name fields to
> Index on to help with searches and use a field that would hold a unique
> data for the Primary field.  With that in mind I always found the
> auto-increment field such as CUSTID as the best choice.  After all there
> each customer should have a unique account number that is not
> duplicated.
>
> Jon
> On Thu, 2003-01-02 at 05:57, Hook wrote:
> > Arie Hol wrote:
> > > Indexes are 'unique' fields in a table - and cannot in any way be
> > duplicated
> > > (otherwise point less having an index) - thus to increase the
efficiency
> > it
> > > is often better to have an auto-increment as an index in a table.
> >
> > Not so. A primary key is by definition unique, and an index can be
defined
> > as holding only unique values, but in general an index is just a short
way
> > of finding data, there's no need for uniqueness.  Most of the indexes
into
> > database tables that I've used/created aren't unique (except for
> > auto_increment fields of course).
> >
> > The Hooker
> >
> --
> Jon Miller <jlmiller at mmtnetworks.com.au>
> MMT Networks Pty Ltd
>
>
>



More information about the plug mailing list