Eliminar índice (dropIndexStatement)
Sintaxis
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
dropIndexStatement_start((START))
dropIndexStatement_start --> dropIndexStatement_0_0[DROP]:::quoted
dropIndexStatement_0_0 --> dropIndexStatement_0_1[INDEX]:::quoted
dropIndexStatement_0_1 --> dropIndexStatement_0_2[IF EXISTS]:::quoted
dropIndexStatement_0_1 --> dropIndexStatement_0_3[identifier]
dropIndexStatement_0_2 --> dropIndexStatement_0_3
dropIndexStatement_0_3 --> dropIndexStatement_0_4[ON]:::quoted
dropIndexStatement_0_4 --> dropIndexStatement_0_5[tableSpec]
dropIndexStatement_0_5 --> dropIndexStatement_end((END))
Propósito
La instrucción drop index elimina un índice de una tabla, tal y como se creó con create index. El nombre del índice es único por tabla, por lo que siempre se debe especificar el nombre de la tabla. Se produce un error cuando la tabla no tiene ningún índice con ese nombre. Con if exists, la instrucción no afecta a ninguna fila.
Al eliminar un índice único, se vuelven a permitir las filas con los mismos valores en sus columnas. La instrucción está disponible para las plataformas de create index. Disponible a partir de la versión 28.0 y de la versión beta 27.1 anterior a ella.
Ejemplos
El siguiente ejemplo elimina el índice orders_n1 de la tabla orders en el almacenamiento en memoria:
drop index if exists orders_n1 on orders@inmemorystorage