db/mysql/ CreateTable


CREATE TABLE mytable ( id INTEGER AUTO_INCREMENT PRIMARY KEY, versiontime TIMESTAMP, path VARCHAR(4000), subdir VARCHAR(4000), pagename VARCHAR(500), source LONGTEXT, INDEX (versiontime, path(500)), INDEX (pagename(100)), FULLTEXT( source ) );

Indexes

See this phoenixnap article. When creating a table

CREATE TABLE mytable ( ..., path VARCHAR(512), INDEX( path ), INDEX( col1, col2(45) ) );

and to add an index to a current table

CREATE INDEX index1 on mytable( col1, col2(45) );
ALTER TABLE mytable ADD INDEX( col1, col2(48) );

Full Text Search

See FullTextSearch and this mysqltutorial article. When Creating a table:

CREATE TABLE mytable ( ..., content TEXT, FULLTEXT( content) );

and to add a FULLTEXT index to a current table

ALTER TABLE mytable ADD FULLTEXT( col1 );