Ad Widget

Collapse

zabbix database migration to primary keys (mariadb): Can I just drop the old tables?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • harri
    Member
    • Nov 2010
    • 89

    #1

    zabbix database migration to primary keys (mariadb): Can I just drop the old tables?

    Hi folks,

    if I got the history_pk_prepare.sql script correctly, it just renames the history tables to something_old and creates new tables using primary keys. Looking at the migration guide (https://www.zabbix.com/documentation...b_primary_keys) I wonder would it be possible to skip the following step (migration with stopped Zabbix server) and drop the old database tables immediately? A short downtime and continuous monitoring is much more important to me than the history of the past 12 months, but I am concerned that there might be side effects next to the lost history.

    Is there some way to ignore history except for the last 4 weeks?

    Will the innodb shrink to some reasonable size in this case?

    Regards
    Harri
    Last edited by harri; 08-01-2023, 17:17.
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    Is there some way to ignore history except for the last 4 weeks?
    Something like this might be worth trying:

    INSERT IGNORE INTO history SELECT * FROM history_old WHERE clock > somevalue;

    Will the innodb shrink to some reasonable size in this case?
    Since each table is saved in a separate file, your tables will be optimally saved when you insert the data in a new table.

    Markku

    Comment

    Working...