MySQL Forums
Forum List  »  Partitioning

truncate partition not happening
Posted by: samir devaliya
Date: January 09, 2012 08:06AM

hi

i am not able to truncate a table please find the below steps i have followed

mysql> CREATE TABLE `dist_product_clover` ( `sourceid` int(11) DEFAULT NULL, `sku` varchar(20) DEFAULT NULL, `isavailable` tinyint(1) DEFAULT NULL, `warehouseid` int(11) DEFAULT NULL, `qtyonhand` float DEFAULT NULL, `lastmodeifiedon` datetime DEFAULT NULL, `activeflag` tinyint(1) DEFAULT NULL, `qtyonorder` float DEFAULT NULL, `pandarequestid` int(11) DEFAULT NULL, KEY `i_src_sku_af` (`sourceid`, `sku`,`activeflag`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC PARTITION BY RANGE (activeflag) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (2) ENGINE =MyISAM);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into dist_product_clover values
-> (95,'no',1,1,0,'2012-01-08',0,null,null);
Query OK, 1 row affected (0.00 sec)

mysql> insert into dist_product_clover values (95,'no',1,1,0,'2012-01-08',1,null,null);
Query OK, 1 row affected (0.00 sec)

mysql> select * from dist_product_clover;
+----------+------+-------------+-------------+-----------+---------------------+------------+------------+----------------+
| sourceid | sku | isavailable | warehouseid | qtyonhand | lastmodeifiedon | activeflag | qtyonorder | pandarequestid |
+----------+------+-------------+-------------+-----------+---------------------+------------+------------+----------------+
| 95 | no | 1 | 1 | 0 | 2012-01-08 00:00:00 | 0 | NULL | NULL |
| 95 | no | 1 | 1 | 0 | 2012-01-08 00:00:00 | 1 | NULL | NULL |
+----------+------+-------------+-------------+-----------+---------------------+------------+------------+----------------+
2 rows in set (0.00 sec)

mysql> alter table dist_product_clover truncate partition p0;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from dist_product_clover;
+----------+------+-------------+-------------+-----------+---------------------+------------+------------+----------------+
| sourceid | sku | isavailable | warehouseid | qtyonhand | lastmodeifiedon | activeflag | qtyonorder | pandarequestid |
+----------+------+-------------+-------------+-----------+---------------------+------------+------------+----------------+
| 95 | no | 1 | 1 | 0 | 2012-01-08 00:00:00 | 0 | NULL | NULL |
| 95 | no | 1 | 1 | 0 | 2012-01-08 00:00:00 | 1 | NULL | NULL |
+----------+------+-------------+-------------+-----------+---------------------+------------+------------+----------------+
2 rows in set (0.00 sec)

mysql>
mysql> select version();
+------------+
| version() |
+------------+
| 5.5.19-log |
+------------+
1 row in set (0.00 sec)
mysql>



kindly guide me where i am wrong..

Regards
Samir

Options: ReplyQuote


Subject
Views
Written By
Posted
truncate partition not happening
3105
January 09, 2012 08:06AM
1434
January 13, 2012 09:58AM


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.