سؤال

My environment will use 2-3 cluster nodes. The db schema at first was designed without knowing the limitation/rules with NDBCLUSTER on (BIG mistake! I know). Some things I notice and want to understand more:

(1) NDB Cluster normally partitions NDBCLUSTER tables automatically. So when I tried to check my table, it shows there are 2 partitions inside

mysql> explain partitions select * from my_request;
+----+-------------+------------+------------+------+
| id | select_type | table      | partitions | type |
+----+-------------+------------+------------+------+
|  1 | SIMPLE      | my_request | p0,p1      | ALL  |
+----+-------------+------------+------------+------+

but when I tried to check which record going to which partition, it gave me error. why?

mysql> select * from my_request partition (p0);
ERROR 1747 (HY000): PARTITION () clause on non partitioned table

(2) Some of my tables will have billions of records, and I (successfully) partitioned it BY RANGE into daily/weekly/monthly. However NDBCLUSTER only allow partition BY (LINEAR) KEY. Since the PRIMARY KEY is a UUID, I kind of lost how to partition the table.

Note: The partition is used not only for optimized query but also to dump and back-up (like dump the data older than 1y). I created an event and procedure to check from partition to do this. ty.

هل كانت مفيدة؟

المحلول

You can partition on a subset of the columns in the primary key. NDB currently doesn't support dropping a partition. So to get rid of old data one needs to use DELETE queries with proper WHERE clauses.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى dba.stackexchange
scroll top