List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:March 30 2004 7:44pm
Subject:RE: Drop all keys / indexes on a table?
View as plain text  
Ugh. I was afraid you were going to say that...  
Seriously, there's no way to just 'wildcard' ALL indexes, someone should add
that as a feature request. We're using 4.0.17 BTW.

What happens if I list out all the indexes that there _could_ be in one
ALTER line like that, and one of the indexes doesn't actually exist? Will
the whole ALTER fail?

Here's the situation, I wrote a script that runs recursively through a
directory and applies all the .sql files it finds (in alpha order). This
script runs as part of a client update, and doesn't necessarily run the same
number of times for everyone. So, some clients may have extra indexes:
foo_1, foo_2, foo_3, ... foo_15 etc. (the problem at hand), and other
clients may just have: foo_1, foo_2, foo_3. 

> -----Original Message-----
> From: Victoria Reznichenko [mailto:victoria.reznichenko@stripped] 
> Sent: Tuesday, March 30, 2004 12:48 AM
> To: mysql@stripped
> Subject: Re: Drop all keys / indexes on a table?
> 
> "Daevid Vincent" <daevid@stripped> wrote:
> > It has come to my attention that we have maxed out our keys 
> due to a stupid
> > update script bug. It seemst that we've not been explicitly 
> naming our keys
> > and therefore mysql tried to be helpful and adds a new key 
> each time!
> > *sigh*.
> > 
> > Is there a SQL command to DROP ALL keys on a table, so I 
> can just ALTER it
> > and add them specifically again?
> > 
> 
> Specify several DROP INDEX clause in the single ALTER TABLE statement:
> 	ALTER TABLE table_name DROP INDEX index_name1, DROP 
> INDEX index_name2, .. , DROP INDEX index_nameN;
> 
> 
> -- 
> For technical support contracts, goto 
> https://order.mysql.com/?ref=ensita
> This email is sponsored by Ensita.net http://www.ensita.net/
>    __  ___     ___ ____  __
>   /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
>  / /|_/ / // /\ \/ /_/ / /__   Victoria.Reznichenko@stripped
> /_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
>        <___/   www.mysql.com
> 
> 
> 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?unsub=1
> 

Thread
Drop all keys / indexes on a table?Daevid Vincent29 Mar
  • Re: Drop all keys / indexes on a table?Victoria Reznichenko30 Mar
    • RE: Drop all keys / indexes on a table?Daevid Vincent30 Mar
      • Re: Drop all keys / indexes on a table?PeterWR30 Mar
        • RE: Drop all keys / indexes on a table?Daevid Vincent30 Mar
          • Re: Drop all keys / indexes on a table?John Thorpe30 Mar
            • RE: Drop all keys / indexes on a table?Daevid Vincent31 Mar
      • using result as a fieldMojtaba Faridzad30 Mar
      • RE: Drop all keys / indexes on a table?Daevid Vincent30 Mar