Friday, February 25, 2011

Alter Mysql table engine

MySQL support different types of storage engines. They are separated by two types of storage engiens based on table handling
 1) transactional tables            
 2) nontransactional tables


NOTE: MySQl allow differnt storage engine types of tables with in a database.
Here we going to see the options how we add the engine detail to table

*) create table
       we can able to define which engine type going to use the table, using ENGINE or TYPE table option.Default engine types to table was MyISAM.

CREATE TABLE tablename  (i INT) ENGINE = MYISAM;
CREATE TABLE tablename  (i INT) TYPE = MYISAM;
 
*) Alter table
if you want to change the storage engine mean, 
just use alter table query
ALTER TABLE tablename   ENGINE = MYISAM;
ALTER TABLE tablename   TYPE = MYISAM;
*) dynamic use
MySQL allow us change the table engine during 
the current session.using "SET" option we can 
able to change the storage engine to the 
particular session
 
SET storage_engine=MYISAM;
SET table_type=MYISAM;

No comments:

Post a Comment