[ZBX-11484] Drop OID's on Postgres databases after update Created: 2016 Nov 15  Updated: 2018 Apr 29  Resolved: 2018 Apr 29

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: 2.0.19, 2.2.15
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: D.Spindel Ljungmark Assignee: Unassigned
Resolution: Unsupported version Votes: 1
Labels: dbpatches, performance, postgres
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

PostgreSQL server



 Description   

Zabbix 1.8 and maybe 2.x created the default tables in Zabbix with OID's explicitly enabled.

The OID isn't used, and isn't created with modern Zabbix installations, and OID's should be dropped from the PostgreSQL instances when upgrading.

Removing OID from a Postgres table involves locking the table for reads & Writes, and will re-write the entire table & indexes.

This process can be. very long, especially with a lot of history or trends in the tables. For our system it was several hours, and the database shrunk with almost 60%!



 Comments   
Comment by Oleksii Zagorskyi [ 2016 Nov 15 ]

I've never noticed the difference in PG zabbix databases.
Indeed, schema for zabbix 1.8 for PG use such syntax for each table:

CREATE TABLE slideshows (
        slideshowid             bigint          DEFAULT '0'     NOT NULL,
        name            varchar(255)            DEFAULT ''      NOT NULL,
        delay           integer         DEFAULT '0'     NOT NULL,
        PRIMARY KEY (slideshowid)
) with OIDS;

2.0 already does not have it.

It could be fixed with upgrade patches, but ... the time required is a serious aspect.
Not sure how to fix it in better way. Maybe just print some message in zabbix_server.log on daemon start with suggestion to perform the change manually in a separate maintenance window ...

In a ZBXNEXT-3550 you described other index changes (which reduced used space too), so is that correct that 60% mentioned in current issue is caused by OIDs drop only ?

Comment by Oleksii Zagorskyi [ 2016 Nov 15 ]

Issue moved to ZBX project, as it's closer to a bug.

Comment by D.Spindel Ljungmark [ 2016 Nov 15 ]

The graph on that blog post is for the OID drop only. I'm expecting another 40% disk usage drop by implementing the changes from ZBXNEXT-3550. After that, I have some more changes ( not yet written about ) that can give further reduction on historical data ( early tests showed that a 3GiB table could get shrunk down to 700MiB, ) but the performance suffered.

So yes, OID dropping alone caused a 60% reduction on one of our DB machines.

I expect that is because those tables were slightly bloated, and a normal expectation would be 15-20% reduction due to OID.

Comment by JB [ 2017 Sep 21 ]

I reduced my database size by almost 50% after removing the oid from my database.

Comment by Glebs Ivanovskis (Inactive) [ 2018 Apr 29 ]

Since the issue only affects versions ≤1.8 upgrading to a newer versions and 1.8 is out of support for quite some time, I'm closing this issue as Unsupported version.

Generated at Thu Apr 25 20:22:00 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.