[MonetDB-users] Vacuum command missing
Hi, I can't find VACUUM command in http://www.monetdb.org/Documentation, I see only vacuum cleaning algorithm mention in http://www.monetdb.org/Documentation/Manuals/SQLreference/Transactions. So, how can phisicaly delete rows after marking them as deleted? -- Thanks, Eugene Prokopiev
2011/7/14 Eugene Prokopiev
I can't find VACUUM command in http://www.monetdb.org/Documentation, I see only vacuum cleaning algorithm mention in http://www.monetdb.org/Documentation/Manuals/SQLreference/Transactions. So, how can phisicaly delete rows after marking them as deleted?
I see it's impossible now - http://bugs.monetdb.org/show_bug.cgi?id=2541 :( So I have only 2 options: 1) copy all table contents to another table, drop old table, copy again 2) emulate partitions with VIEW AS SELECT * FROM T1 UNION SELECT * FROM T2 UNION ... and drop old partition -- Thanks, Eugene Prokopiev
Eugene, indeed, for now, MonetDB does not provide any vacuum functionality to physically remove deleted records. Basically, the physical representation of BATs as dense consecutive arrays that are one reason for MonetDB's efficient query processing, prohibit a "trivial" and efficient vacuum. In general, any vacuum would require an efford linear in the table size, basically copying all non-deleted record into a new location. Thus, the two approaches you suggest are the most reasonable for now. An other alternative is to dump the table contents into a CSV file, clear the table contents, and bulkload it from CSV file, again, e.g., COPY SELECT * FROM <table> INTO <file>; DELETE FROM <table>; COPY INTO <table> FROM <file>; (obviously at the expense of serializing and parsing the whole data). Stefan On Wed, Jul 20, 2011 at 09:52:43AM +0400, Eugene Prokopiev wrote:
2011/7/14 Eugene Prokopiev
: I can't find VACUUM command in http://www.monetdb.org/Documentation, I see only vacuum cleaning algorithm mention in http://www.monetdb.org/Documentation/Manuals/SQLreference/Transactions. So, how can phisicaly delete rows after marking them as deleted?
I see it's impossible now - http://bugs.monetdb.org/show_bug.cgi?id=2541 :(
So I have only 2 options:
1) copy all table contents to another table, drop old table, copy again 2) emulate partitions with VIEW AS SELECT * FROM T1 UNION SELECT * FROM T2 UNION ... and drop old partition
-- Thanks, Eugene Prokopiev
------------------------------------------------------------------------------ 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks & Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
I've found file /usr/lib64/monetdb5/createdb/20_vacuum.sql with this functions: -- Vacuum a relational table should be done with care. -- For, the oid's are used in join-indices. -- Vacuum of tables may improve IO performance and disk footprint. -- The foreign key constraints should be dropped before -- and re-established after the cluster operation. create procedure shrink(sys string, tab string) external name sql.shrink; create procedure reuse(sys string, tab string) external name sql.reuse; create procedure vacuum(sys string, tab string) external name sql.vacuum; Which approach is used in above vacuum procedure? I tried to use it: sql>delete from sys.transfer_ip ; 651950 affected rows (117.620ms) sql>call vacuum('sys','transfer_ip'); sql>select vacuum('sys','transfer_ip'); MAPI = (monetdb) /tmp/.s.monetdb.50000 ACTION= read_line QUERY = select vacuum('sys','transfer_ip'); ERROR = !Connection terminated Database size was the same. -- Thanks, Eugene Prokopiev
participants (2)
-
Eugene Prokopiev
-
Stefan Manegold