You can use the mysqlshow command to list all disabled keys:
e.g.:
mysqlshow -k world foo
When the indexes are displayed the word "disabled" will be in the comment
field
--
Partha Dutta, Senior Consultant
MySQL Inc, NY, USA, www.mysql.com
Are you MySQL certified? www.mysql.com/certification
Victor Pendleton wrote:
> Try show index from t1;
> Show index from t2;
Hi Victor,
Nope, this does not help. t1 has key disabled, t1 enabled, and the
result is the same:
mysql> show index from t1\G
*************************** 1. row ***************************
Table: t1
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: x
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
1 row in set (0.00 sec)
mysql> show index from t2\G
*************************** 1. row ***************************
Table: t2
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: x
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
1 row in set (0.00 sec)
cheers,
Jacek
>
> -----Original Message-----
> From: Jacek Becla [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 03, 2005 4:00 PM
> To: Jay Blanchard
> Cc: [EMAIL PROTECTED]
> Subject: Re: how to check if keys disabled?
>
> Jay
>
> Are you sure? DESCRIBE tells me the table has an index, but not whether
> the index is enabled or not:
>
> mysql> create table t1 (x int primary key);
> Query OK, 0 rows affected (0.01 sec)
>
> mysql> create table t2 (x int primary key);
> Query OK, 0 rows affected (0.01 sec)
>
> mysql> alter table t1 disable keys;
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> describe t1;
> +-------+---------+------+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +-------+---------+------+-----+---------+-------+
> | x | int(11) | NO | PRI | | |
> +-------+---------+------+-----+---------+-------+
> 1 row in set (0.00 sec)
>
> mysql> describe t2;
> +-------+---------+------+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +-------+---------+------+-----+---------+-------+
> | x | int(11) | NO | PRI | | |
> +-------+---------+------+-----+---------+-------+
> 1 row in set (0.00 sec)
>
> Am I missing something?
>
> thanks,
> Jacek
>
>
> Jay Blanchard wrote:
>
>>[snip]
>>How can I find out if keys are enabled/disabled for a given table?
>>
>>Suppose I do:
>>create table t1 (x int primary key);
>>create table t2 (x int primary key);
>>alter table t1 disable keys;
>>
>>How can I now find out that t1 has keys disabled, and t2 enabled?
>>[/snip]
>>
>>DESCRIBE t1 or DESCRIBE t2
>
>
>