SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,316
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    What query to remove index on fields?

    I accidentally create a second index on several fields, not realizing that I already had such an index. PHPMyAdmin showed me my error. What is the query that removes an index?

    Thanks!

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2007
    Posts
    566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,316
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much!

  4. #4
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,316
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I used PHPMyAdmin to create the index. I checked each column for which I wanted included in the index, then clicked on the Index button. I notice that to drop an index, one specifies the name of the index:

    DROP INDEX index_name ON tbl_name

    I did not give a name to any of my indexes (PHPMyAdmin did not prompt for one). How do I drop an unnamed index? Using * in place of the name did not work.

    Thanks.

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,021
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    run the following query in the SQL tab:
    Code:
    SHOW CREATE TABLE tablename
    this should show you the index name
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,316
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Great! That solved my problem. Another scrap of code to add to my cheat sheet!

    Thanks,
    Steve


Bookmarks

Posting Permissions

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