MySQL Forums
Forum List  »  MySQL Administrator

Delete data from tablespace
Posted by: Markus Fladischer
Date: March 16, 2012 04:32AM

I have a mysql-cluster 7.1.10 (using NDBD) running and I use tablespaces to save one of my tables to disk. I created the table space and altered the appropriate table to use the tablespace. To see if the tablespace is used:

mysql> SELECT FILE_NAME, (FREE_EXTENTS*EXTENT_SIZE) AS FREE_SPACE, (TOTAL_EXTENTS*EXTENT_SIZE) AS TOTAL_SPACE, EXTRA FROM information_schema.FILES WHERE FILE_TYPE = 'DATAFILE';

OUTPUT:
+---------------------+------------+-------------+----------------+
| FILE_NAME | FREE_SPACE | TOTAL_SPACE | EXTRA |
+---------------------+------------+-------------+----------------+
| data_cmn_free_1.dat | 4294967296 | 4294967296 | CLUSTER_NODE=4 |
| data_cmn_free_1.dat | 4294967296 | 4294967296 | CLUSTER_NODE=5 |
| data_cmn_free_1.dat | 4294967296 | 4294967296 | CLUSTER_NODE=6 |
+---------------------+------------+-------------+----------------+
3 rows in set (0.00 sec)

After a while there is some data in the table so I check again if the tablespace is used correctly (same query): FREE_SPACE switches from 4294967296 to 4093640704

+---------------------+------------+-------------+----------------+
| FILE_NAME | FREE_SPACE | TOTAL_SPACE | EXTRA |
+---------------------+------------+-------------+----------------+
| data_cmn_free_1.dat | 4093640704 | 4294967296 | CLUSTER_NODE=4 |
| data_cmn_free_1.dat | 4093640704 | 4294967296 | CLUSTER_NODE=5 |
| data_cmn_free_1.dat | 4093640704 | 4294967296 | CLUSTER_NODE=6 |
+---------------------+------------+-------------+----------------+

Now I have to delete data from the table. After deletion, the table is empty but the tablespace remains - but in my understanding, the tablespace should be completely free again:

+---------------------+------------+-------------+----------------+
| FILE_NAME | FREE_SPACE | TOTAL_SPACE | EXTRA |
+---------------------+------------+-------------+----------------+
| data_cmn_free_1.dat | 4093640704 | 4294967296 | CLUSTER_NODE=4 |
| data_cmn_free_1.dat | 4093640704 | 4294967296 | CLUSTER_NODE=5 |
| data_cmn_free_1.dat | 4093640704 | 4294967296 | CLUSTER_NODE=6 |
+---------------------+------------+-------------+----------------+

When table is filled again, the tablespace is not used any more - the query above leads to the same output, FREE_SPACE = 4093640704, but should be 4294967296 again.

So I need to know how to use the tablespace again.

Options: ReplyQuote


Subject
Written By
Posted
Delete data from tablespace
March 16, 2012 04:32AM


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.