2009-12-31 15 views
32

E 'creato in questo modo:Come abbandonare questo indice in MySQL?

create table listings(
    id integer unsigned NOT NULL AUTO_INCREMENT, 
    accountId integer unsigned default null, 
    title varchar(300) not null, 
    country integer unsigned, 
    region integer unsigned, 
    type integer unsigned, 
    price integer, 
    unit varchar(20) not null, 
    priceUSD decimal(12,2), 
    bedrooms integer unsigned, 
    thumbnail varchar(100) default null, 
    keywords text, 
    created datetime, 
    deleted boolean default 0, 
    fulltext index (keywords), 
    PRIMARY KEY (id) 
) engine=MyISAM; 

come far cadere tale indice full-text che non ha nome?

Cosa succede se l'indice non denominato è: fulltext index (title ,keywords)?

risposta

27

eseguire questo comando nel client mysql:

mysql> SHOW CREATE TABLE listings; 

Vi mostrerà il DDL per la tavola, compreso il nome assegnato dal sistema per l'indice.

+0

Oh, ho appena lasciato cadere l'indice, quindi non riesco a vedere il risultato ... – user198729

+0

Usa il tuo database' test' e crea una nuova tabella vuota con un indice di testo completo, solo così puoi osservare come 'show create table' mostra i nomi assegnati dal sistema per indici e vincoli. –

60
ALTER TABLE listings DROP INDEX keywords; 
+0

Perché funziona? Io non specificare il suo nome come 'keywords' – user198729

+1

sì proprio come FULLTEXT KEY' keywords' ('keywords') –

6

alter tabella indice your_table_name goccia your_index_name O

goccia indice your_index_name su your_tbl_name