As described in Section 2.5, “Changelog”, all events are written to the ChangeLog
table of
the database. The table is never truncated by default in order to enable event replay right from the beginning.
Nevertheless, you might want to reduce the size of the evergrowing table on your own. In one go, you can also
truncate the linkchangelog
table. That is, because the sequenceno
in this table is a foreign key to
the sequenceno
in the changelog
table and therefore useless if you delete the respective row in the
changelog
table.
Caution | |
---|---|
If you delete events from the changelog, listeners which try to retrieve these events will fail. In particular, Replication Live Server that have not caught up with the Master Live Server will become unusable. |
Prerequisites
If you want to truncate the ChangeLog
table the following prerequisites should be fulfilled:
Little system load for example in the evening.
All clients which use the
ChangeLog
are up to date.New backup of the system has been made
Truncate the ChangeLog
When you truncate the ChangeLog
, you should not delete all entries. You may leave 100000 entries which
is a good value proven by practice. Proceed as follows:
Get the maximum sequence number from the database using the following SQL statement:
select max(sequenceno) from changelog
Delete all but the last 100000 entries from the table. Replace
<LimitSequenceNo>
with the maximum sequence number minus 100000:
delete from changelog where sequenceno < <LimitSequenceNo>
Delete also all but the last 100000 entries from the
linkchangelog
table.
delete from linkchangelog where sequenceno < <LimitSequenceNo>
All but the last 100000 entries are deleted from the changelog
and linkchangelog
table.