Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    20

    Unanswered: Hitting a MySQL Index

    Lets say I have a Table Ta with an index with 3 fields.
    F1, F2, F3

    I use a web based interface to create the index by selecting the table then selecting the fields in the index. So I don't know what 'order' the index is in.

    I can run a 'show create table' statement and it shows them in oder of:
    F2, F3, F1

    When I query this table I want to use this index. I query (or join this table with another using the index).

    I want to 'walk down the index' because it should be faster. But is this so with MySQL?? Does the Order I hit then index matter? If so, why doesn't my web based interface allow me to determine the order of the fields in the index?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    because your web based interface is lame, that's why

    hopefully your web based interface will let you run a query, so you can always define the index--and get the right column sequence--with raw SQL
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2007
    Posts
    20
    So to recap, the order you hit the index does matter in MySQL just like in any other database. So I use sql to create my indexes rather than the web based interface?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by landrun
    So I use sql to create my indexes rather than the web based interface?
    if your web based interface does not let you designate the sequence of columns in the index, then yes
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •