Announcement

Announcement Module
Collapse
No announcement yet.

INDEXEs

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • INDEXEs

    Hi

    another newbie question

    1)I have one innodb TABLE. With 2 fields, ID and VALUE. INT and VARCHAR respectively.

    2)I setup ID as PRIMARY KEY.

    so, in this veary silly environment, is this PRIMARY KEY a kind of mysql INDEX?

    Will PRIMARY KEY help MYSQL to searchs, etc? Or I still need another INDEX?

    Thanks!

  • #2
    Yes the primary key is an UNIQUE INDEX.
    It's just that since it uniquely identifies each record in the table it stands out and exists in (almost) every table and that is why you call it the PRIMARY KEY.

    And yes it will be used to speed up searches.

    Comment


    • #3
      Thank you Sterin!

      Comment


      • #4
        The primary key is formally defined as a minimal candidate key. If you don't know what that means, don't worry, but it might be interesting for you to read up on it anyway.

        In MySQL, a primary key is implemented as a unique non-nullable index named PRIMARY. Note: an index and a key are not the same thing. A key is implemented through an index in most databases.

        Comment

        Working...
        X