New answers tagged

2

According to the official ALTER TABLE documentation, there should be no issue with such an operation and there is no window when there is no UNIQUE constraint at all. See (emphasis mine): Storage, Performance, and Concurrency Considerations In most cases, ALTER TABLE makes a temporary copy of the original table. MySQL waits for other operations that ...


0

I think the answer is no because of something I recently experienced (2 months ago in 5.6.21). I did something similar to you in a DDL script for a client. I spent 20 min watching the temp file grow with the new layout. I was expect the temp file to just get renamed automatically to the original table. Instead the temp file disappeared. No error was ...


0

I just remembered you can quote table names, and I guess this works to escape the question marks. ALTER MATERIALIZED VIEW temp_name_relationships RENAME COLUMN "?column?" TO score;


2

I tested the case. You can do it faster using below steps: Create the same table structure with a different name (call it Tbl2) Alter the column on Tbl2 insert data from Tbl1 into Tbl2 Drop Tbl1 (the old table) Rename Tbl2 (the new one) to Tbl1 This will give you much better performance. The reason is, altering the column on table containing data, will ...


8

Assuming all previously-created columns are fixed-width like char and datetime, adding column C above just added it to the end of the fixed-width section of the record (effectively a meta-only change). However, recasting it as a varchar required it to be moved to the variable-width section of the record, forcing an implicit rebuild of the table. Paul Randal ...


4

I have an oracle database table with date format as 'mm/dd/yyyy' No you don't.. ;) You have an Oracle database table with a date datatype. Period. Any type of "format" is for display only, and is easily modified. SQL> create table junk ( id number, dd date ); Table created. SQL> insert into junk values ( 1, sysdate ); 1 row created. ...



Top 50 recent answers are included