MySQL Forums
Forum List  »  Partitioning

Re: Partitioning & Tablespace
Posted by: Mattias Jonsson
Date: June 01, 2011 03:57AM

Hi,

If you have one single file per table, then the table is not partitioned (on have only one partition).

In 5.1 innodb_file_per_table must be set when starting the server, like in the my.cnf file.

To enable separate 'tablespace' for InnoDB in 5.5:
SET GLOBAL innodb_file_per_table = ON;



To create a partitioned table:
CREATE TABLE t (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY HASH (a) PARTITIONS 3;

This would create three files:
t#P#p0.ibd, t#P#p1.ibd and t#P#p2.ibd besides the .par and .frm table files.
A non partitioned innodb table would only have the t.frm and t.ibd files.

For MyISAM (and not Windows) you can do:
CREATE TABLE t2(a INT, b VARCHAR(64))
ENGINE = MyISAM
PARTITION BY RANGE (a)
(PARTITION pNeg VALUES LESS THAN (0)
DATA DICTIONARY '/data_path_0/' INDEX DIRECTORY '/index_path_0/',
PARTITION p100 VALUES LESS THAN (100)
DATA DICTIONARY '/data_path_1/' INDEX DIRECTORY '/index_path_1/',
PARTITION p1000 VALUES LESS THAN (1000)
DATA DICTIONARY '/data_path_2/' INDEX DIRECTORY '/index_path_2/';

where you can specify both data and index files to different spindles for each partition.

for more details, see the manual, starting at:

http://dev.mysql.com/doc/refman/5.5/en/create-table.html

Options: ReplyQuote


Subject
Views
Written By
Posted
4502
May 29, 2011 10:13AM
Re: Partitioning & Tablespace
2386
June 01, 2011 03:57AM
1989
June 01, 2011 07:34PM
1613
June 02, 2011 01:02PM
1910
June 02, 2011 07:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.