I am in no way recommending anyone do this, but while doing some debug tasks that involved digging through Ignition's internal TAGCONFIG database I noticed that the JSON fields include a lot of white space.
Out of curiosity, I decided to minimize all of the JSON fields and see how much space it would save. I did an SQLite VACUUM
both before and after to ensure it was a meaningful comparison. For reference, we have over 1.2 million tags...
Before = 960MB
After = 790MB
This is not an insignificant change. I have not yet tried to reload this config back into Ignition, but I'm expecting it should go easily and will be trying it soon on a test system.
For the truly brave of heart:
import json
import sqlite3
# SQLite has a built in json() function which is supposed to verify that its
# argument X is valid JSON and return a minified version.
# I originally tried this with: UPDATE TAGCONFIG SET CFG=JSON(CFG)
# but it flagged some of my TAGCONFIG entries as invalid.
# Python's json.loads() had no such complaints about those same entries.
# So, we minify them using Python... :/
db_connection = sqlite3.connect('ignition_config.idb')
print('Loading...')
all_tags = [x for x in db_connection.execute('SELECT ID, CFG FROM TAGCONFIG')]
print('Scanning...')
param_list = []
for tag_id, cfg in all_tags:
repack_cfg = json.dumps(json.loads(cfg), separators=(',', ':'))
param_list.append((repack_cfg, tag_id))
print('Updating...')
db_connection.executemany('UPDATE TAGCONFIG SET CFG=? WHERE ID=?', param_list)
db_connection.commit()
print('Done!')
db_connection.close()