Posts

Showing posts from 2017

PostgreSQL - CREATE & ALTER INDEX

CREATE INDEX To create a B-tree index on the column  title  in the table  films : CREATE UNIQUE INDEX title_idx ON films (title); ALTER INDEX ALTER INDEX distributors RENAME TO suppliers; ALTER INDEX name RENAME TO new_name

MYSQL - PRIMARY KEY DESCRIPTION

A  PRIMARY KEY  is a unique index where all key columns must be defined as  NOT NULL . If they are not explicitly declared as  NOT NULL , MySQL declares them so implicitly (and silently). A table can have only one  PRIMARY KEY . The name of a  PRIMARY KEY  is always  PRIMARY , which thus cannot be used as the name for any other kind of index. If you do not have a  PRIMARY KEY  and an application asks for the  PRIMARY KEY  in your tables, MySQL returns the first  UNIQUE  index that has no  NULL  columns as the  PRIMARY KEY .

MYSQL STORAGE ENGINE STATUS CHECK

MYSQL STORAGE ENGINE COMMANDS 1. How to check Global storage engine : SHOW GLOBAL VARIABLES LIKE 'storage_engine'; 2. How to check all table status/engine for Particular database : SHOW TABLE STATUS FROM 'DBNAME'; 3. How to Find out InnoDB tables of Particular database : SELECT TABLE_NAME FROM information_schema.TABLES     WHERE TABLE_SCHEMA = 'DBNAME' AND engine = 'InnoDB'; 4 Check Table Status with Condition : SHOW TABLE STATUS FROM 'DBNAME' WHERE ENGINE like 'MyISAM' 5 Modify or Update ENGINE of particular table in MYSQL ALTER TABLE tablename ENGINE = InnoDB; 6 Check data tables rows,size & engine details of selected/multiple database in MYSQL SELECT    engine,         count(*)    as    TABLES,         concat(round(sum(table_rows)/1000000,2),'M')    rows,         concat(round(sum(data_length)/(1024*1024*1024),2),'G')    DATA,  ...