IMD SolutionComputing LibraryShop main store

Explainer

Why Ignition tag historian creates MySQL double columns

Edge computing and IIoT Published 6 min read

Short answer

The DOUBLE and BIGINT columns come from the MySQL translator's type mapping, which sizes generated columns for any tag value. Switching that mapping to FLOAT touches every table the connection generates and saves about 346 MB per day in the worked example below while cutting precision to about 7 significant digits. Keep DOUBLE; set the decimals an operator sees in the display's number format.

On this page
  1. Where the DOUBLE and BIGINT columns come from
  2. Why the extra decimals are a display question
  3. What a translator edit would actually touch
  4. Example: what FLOAT saves on a 100-million-sample partition
  5. The decision, case by case
  6. Questions asked

The extra decimals are not a historian fault. The DOUBLE column exists because the MySQL translator answers the question "which SQL type holds a Java double?" with DOUBLE, and answers the 64-bit integer question with BIGINT; Ignition asks both every time it creates a historian table or partition. You can repoint that mapping at FLOAT, but the edit lands on every connection using the translator and on every table Ignition generates through it, and it trades roughly half the stored precision for a modest cut in size. The clean fix for visible decimals is the number format at the display, and the storage fix is fewer samples.

Where the DOUBLE and BIGINT columns come from #

When you enable history on a tag, the Tag Historian stores data in your SQL database automatically; the 8.1 manual documents that behavior plainly. The tables it creates are deliberately generic: one column holds the float values of every tag you log, another holds integer values, another strings, so the schema does not depend on how many tags you have or what they contain. A column shared by all floating-point tags has to accept anything, so Ignition asks the connection's database translator which SQL literal to use for a double and for a long integer. On MySQL the answers are DOUBLE and BIGINT. That is also why a tag holding two decimal places still lands in DOUBLE: the column type comes from the translator, not from the tag.

The mapping itself is configuration. In the Ignition 7.8 manual, JDBC drivers and translators are managed in the Gateway from the Databases > Drivers > Translators tab, and the Gateway ships with translators for the major databases already configured. Locate the corresponding page in the manual for your own release rather than assuming the path carried over. Each translator carries column mappings, including the double column entry that sets which SQL literal Ignition puts in a generated floating-point column.

Why the extra decimals are a display question #

Java doubles and MySQL DOUBLE values are IEEE 754 binary floating point. Most decimal fractions, 0.1 being the classic case, have no exact binary representation, so the stored value is the nearest representable approximation, good to about 15 to 16 significant digits. The tag carried that approximation before the historian ever saw it; DOUBLE simply preserves it. A display, query or report that prints every available digit is showing you the approximation, not corrupting your data.

That is the same arithmetic behind why a Sparkplug float can show 16 decimals while the historian panel shows three. Dropping the column to FLOAT does not clean anything up: it keeps roughly half the significant digits and discards them from every sample you ever store. What an operator sees is decided by the numeric format on the display component or the report, and changing that format touches no stored data. If a formatted field still prints more digits than its format asks for, that failure has its own write-up on why a numeric format setting shows extra decimals.

What a translator edit would actually touch #

The double column mapping is shared. Change it and every MySQL connection using that translator picks up the new literal, including connections added later, and so does every source of Ignition-generated tables on those connections, transaction groups included. A duplicate translator entry, assigned only to the historian's connection, contains the change to that connection, but it does not make the mapping exclusive to the historian: any table Ignition generates on that connection still follows it.

There is no Tag Historian setting for one table's column type, and there is no migration. The mapping is read when Ignition creates a table or a new partition, so an ALTER on today's partition leaves the next partition back on DOUBLE, and you would be altering each partition as it appears for as long as the system logs. Disabling partitioning so you can alter the table once trades away the size management partitioning provides, which is a poor deal for a column you are trying to make smaller. If you genuinely need rows in a differently typed table, the honest job is a copy into a new table with the columns you want, the same mechanics as copying MySQL data into a new table with extra columns.

Example: what FLOAT saves on a 100-million-sample partition #

MySQL documents FLOAT at 4 bytes and DOUBLE at 8 bytes per stored value. Take a partition holding 100 million float samples:

  • DOUBLE column: 100,000,000 × 8 = 800,000,000 bytes ≈ 763 MiB
  • FLOAT column: 100,000,000 × 4 = 400,000,000 bytes ≈ 381 MiB
  • Saving: about 381 MiB, and only that one column shrinks.

Now put a rate on it. If 5,000 tags each store a sample every 5 s on change, the stream is 5,000 ÷ 5 = 1,000 samples/s, and 100 million samples accumulate in 100,000,000 ÷ 1,000 = 100,000 s, about 27.8 h or 1.2 days. The saving works out to (8 − 4) bytes × 1,000 samples/s = 4,000 bytes/s, which over a day is 4,000 × 86,400 = 345.6 MB per day.

Precision moves the other way: FLOAT holds about 7 significant decimal digits, so a flow total such as 1,234.5678, eight significant digits, comes back as roughly 1,234.568, and everything past the seventh digit is gone for good. Meanwhile each sample row still carries its timestamp and the other typed columns, so the whole table shrinks by well under half.

That 346 MB per day is measurable, but sample reduction usually buys more: cutting the same stream from 1,000 to 100 samples/s removes 9 of every 10 rows outright, timestamp and all, which is why cutting Ignition Tag Historian growth before compressing the table and why an Auto deadband style delays tag history storage come before any column-type edit.

The decision, case by case #

  • Extra decimals on screen or in a report: keep the column type as it is and set the number format on the display component or report. Nothing in the database changes, and the fix is one property.
  • Storage growing faster than you like: keep the column type and cut sample count with deadband settings, coarser log rates or event-based logging. Every row you do not write saves the timestamp and every column, not half of one column.
  • A hard external requirement for a different column type: duplicate the translator, assign the copy to a dedicated connection, prove a freshly created partition comes out with the intended type, then point only the historian at it, and re-verify the assignment after any Ignition upgrade. Or skip the generated schema and write with the system.db functions into tables you define.
  • Never: edit the double mapping on a translator that also serves transaction groups or future connections, and do not ALTER partitions one at a time as they roll. The next partition reverts, and your history ends up typed two different ways.

Questions asked

Can I set the column type for the historian only?

No. The mapping belongs to the database translator, not to the Tag Historian, so there is no per-module or per-table setting. A duplicate translator entry assigned to one connection keeps the change off your other connections, but every Ignition-generated table on that connection, historian partitions and transaction group tables alike, still receives the same SQL literal.

If I change the mapping, what happens to history already stored?

Nothing retroactively. Ignition reads the mapping when it creates a table or a new partition, so existing partitions keep their current type and only future ones change. You would then hold two precisions across one history range, and queries spanning the boundary return samples stored at different resolutions.

How much space does FLOAT really save in MySQL?

MySQL stores FLOAT in 4 bytes and DOUBLE in 8 bytes. On the 100-million-sample partition in the example, that takes the float column from about 763 MiB to about 381 MiB; the timestamp and the other columns in each row are unchanged, so the table as a whole loses far less than half its size.

What is the supported way to store tag history in tables I define myself?

Ignition's scripting library includes system.db functions that run inserts against any table you create, so you choose the column types, indexes and retention yourself. You take over what the historian otherwise handles: buffering across connection loss, partition management, and the query interface that trend and report components use. For a small number of tables with a fixed schema, that is a reasonable trade.

Keep reading

  • Troubleshooting

    Ignition historian create table fails after a disabled restore

    The double in the failing CREATE TABLE means the MSSQL JDBC driver has no translator selected: a restore with the disable option checked disabled every translator, so generic type names reach SQL Server unchanged and the statement fails to parse. Enable the translators, select the MSSQL translator under Connections > Databases > Settings, restart the gateway, and the sqlt_data partition table creates.

    Edge computing and IIoT

  • How-to

    Setting historian pruning and retention for Ignition tag history

    Prune tag history on the history provider, not with the transaction group's delete setting: in the Gateway's tag history configuration, enable data pruning and set a retention period in days. At 250 MB per day of growth, 30 days of retention holds about 7.5 GB and a full year about 91 GB. Deadband and Max Time Between Samples decide most of the daily rate, and QC records from transaction groups keep growing on a separate budget.

    Edge computing and IIoT

  • Explainer

    Tag Historian vs SQL Bridge storage for a short-term trend database

    Use Tag Historian for plant-wide short-term trending because it stores narrow, on-change rows; keep SQL Bridge for PLC-to-database handshakes that need one wide row per group execution. Copy closed time partitions and the tag-mapping tables to the downstream historian, and prune only after the copy is confirmed.

    Edge computing and IIoT