Reconstruir / reorganizar um índice
Oracle
ALTER INDEX customer_city_idx REBUILD ONLINE;ONLINE reconstrói sem bloquear a tabela (Enterprise Edition). Para movê-lo para outra tablespace: ... REBUILD TABLESPACE new_ts.
PostgreSQL
REINDEX INDEX CONCURRENTLY customer_city_idx;
-- Whole table: REINDEX TABLE CONCURRENTLY customer;CONCURRENTLY (PG 12+) reconstrói sem bloquear as escritas na tabela; mais lento, porém seguro.
MySQL
-- Rebuild InnoDB indexes + table:
ALTER TABLE customer ENGINE=InnoDB, ALGORITHM=INPLACE, LOCK=NONE;
-- Alternative: OPTIMIZE TABLE customer;LOCK=NONE permite escritas concorrentes; INPLACE pode não ser possível para todo ALTER.
SQL Server
-- Rebuild for high fragmentation:
ALTER INDEX ALL ON dbo.customer REBUILD WITH (ONLINE = ON);
-- Lighter option for low fragmentation:
-- ALTER INDEX ALL ON dbo.customer REORGANIZE;Limite comum: fragmentação de 5-30% REORGANIZE, >30% REBUILD. ONLINE é um recurso da Enterprise.
MongoDB
db.customer.reIndex()Reconstrói todos os índices em primeiro plano e bloqueia a coleção. No 6.0+ só roda em standalone (não é permitido em membros de replica set); em um replica set, reconstrua um único índice com dropIndex + createIndex, nó por nó (rolling).
Redis
# Not applicable (core). If RediSearch is used:
# FT.ALTER / rebuilding is done per the module documentation.O modelo chave-valor não tem manutenção tradicional de índices.