← Back to team overview

maria-discuss team mailing list archive

AUTO_INCREMENT and partitioning

 

Hi,

1- I have a table with a unique key which is calculated by the
AUTO_INCREMENT feature, and I need to range partition it using a date field
, is it possible and/or how to do it?

2- Is there a way to implement sequences for the primary key (like it
exists in Oracle) or the AUTO_INCREMENT is the only one in MariaDb?

For example:

 CREATE TABLE new (

         id INT NOT NULL AUTO_INCREMENT,

         name VARCHAR(50),

        added DATE,

         PRIMARY KEY (id),

     )

    PARTITION BY RANGE( TO_DAYS(added) )

  ( PARTITION p0 VALUES LESS THAN (1990),

   PARTITION p1 VALUES LESS THAN (2000),

   PARTITION p2 VALUES LESS THAN MAXVALUE

	 ) ;

Thanks

Follow ups