IMD SolutionComputing LibraryShop main store

Explainer

Can Ignition Edge run SQL queries through a central gateway

Edge computing and IIoT Published 8 min read

Short answer

No: an Ignition Edge gateway has no database connections, and linking it to a fully licensed central gateway does not add SQL. The supported paths are native remote tag history for trends and a system.util.sendRequest message API you build yourself, with the central gateway executing named queries server-side.

On this page
  1. Can an Ignition Edge gateway run an SQL query at all?
  2. Does connecting Edge to a fully licensed central gateway add SQL?
  3. Can Edge send a message so the central gateway runs the query?
  4. Why should the message never carry raw SQL text?
  5. How long does Edge keep tag history without any SQL?
  6. When does remote tag history beat a custom message API?
  7. What should you decide for each requirement?
  8. Questions asked

No, an Ignition Edge gateway cannot run SQL queries, and connecting it to a fully licensed central gateway does not change that. SQL in Ignition always runs through a database connection created on the gateway that executes it, and Edge editions provide no database connections. What the connection does give you is two supported paths: native remote tag history for long-term trends, and the documented message function system.util.sendRequest, with which the Edge gateway can ask the full gateway to execute a named query server-side and return the result. The second path is a small API you design, secure and maintain yourself. This article gives the retention numbers that decide whether you need it at all, the arithmetic to check them against your logging rate, and the decision for each requirement.

Can an Ignition Edge gateway run an SQL query at all? #

No — every SQL query in Ignition runs through a database connection created on the gateway that executes it, the Edge editions provide no database connections, and hardware changes nothing because this is a product capability, not a performance limit.

Named queries, the query browser, transaction groups against databases and every scripted query all sit on top of that database connection. Without one, an Edge gateway has no place to point a SELECT and no engine to parse it, no matter how much RAM or how fast a processor the box carries. Adding compute cannot enable a function the product does not ship.

What an Edge gateway does have is a local tag provider, a scripting environment, store-and-forward for history and the Gateway Network client. Those are the tools you build with; direct SQL is not among them.

Does connecting Edge to a fully licensed central gateway add SQL? #

No — a Gateway Network connection gives the Edge gateway remote tag providers and gateway-to-gateway messaging, but SQL only runs on gateways that hold database connections, so the Edge scripting environment still has nothing to execute a query against.

This holds whether the Edge gateway runs as a native install or in a container; see running Ignition Edge Panel natively or in Docker on an industrial PC for that deployment choice, which is independent of query capability.

Separate three requirements before choosing an architecture, because they need different interfaces:

  1. Displaying historical tag values. A trend of process values, old and new.
  2. Reading application records. Work orders, batch records or other rows in application SQL tables.
  3. Operator-issued database queries. Arbitrary SQL typed or built by an operator screen.

A central gateway whose primary role is Tag Historian is not automatically an application database service. Its job is storing and serving history; pointing application screens at it as a general SQL backend mixes two workloads that fail in different ways.

Can Edge send a message so the central gateway runs the query? #

Yes, technically — the documented system.util.sendRequest function sends a message from the Edge gateway to a message handler you configure on the full gateway, that handler executes a named query or system.tag.queryTagHistory server-side, and the result returns to Edge; you design and maintain that API yourself.

The pieces, all documented gateway functions:

  • The Edge gateway script calls system.util.sendRequest with an operation name and constrained parameters, and blocks until the response arrives.
  • The handler on the full gateway resolves that operation name to one defined named query with bound parameters, or calls system.tag.queryTagHistory against the historian provider.
  • The handler returns a defined result structure, not a raw schema, and the Edge script binds it to the display.

Two things to settle before you build it. First, licensing: discussions of this architecture name Edge Compute as the edition where messaging fits, but entitlements are edition-specific, so verify the license on your installed Edge edition before writing the first handler. Second, ownership: this is your API now — parameter validation, timeouts, versioning and monitoring are yours to keep working across Ignition upgrades. That is a reasonable price for a handful of defined reads. It is not a reasonable price for a general database layer under every screen.

Why should the message never carry raw SQL text? #

Never put SQL text in the message — a caller-supplied query string turns every Edge screen into a database client, and an encrypted Gateway Network connection protects transport only, not what the caller may ask the database to do.

Transport protection and two-way certificate authentication prove who is talking. They say nothing about what the talking is allowed to do. The boundary has to live in the handler on the central gateway:

  • Keep query definitions and database credentials on the central gateway, never in Edge scripts.
  • Accept an operation name from a fixed set, not a query string, and bind all values as parameters.
  • Validate requested time ranges and restrict selectable assets to an allowed list.
  • Run the database account read-only, and cap returned rows server-side, because an authorized but expensive query can still starve the historian and other screens.

Treat the handler as the only door: it, not the network, decides what the caller may ask. Sending raw SQL in the message tears that door off its hinges.

How long does Edge keep tag history without any SQL? #

Original Edge design targeted about one week of local history; current Edge licensing is documented up to one month of history capped at 10 million rows, so the calendar number alone decides nothing — the row cap does.

High-volume logging can exhaust the cap in hours, and sparse logging can stretch it well past the calendar window, so measure the oldest timestamp your Edge gateway actually serves under your real tag count and rate. Local Edge retention and central historian retention are separate quantities; set the central side with the pruning and retention settings for Ignition tag history.

Worked example. Take 200 tags storing roughly one change per minute with deadband logging. Rows per day: 200 tags × 1,440 minutes per day = 288,000 rows per day. Days to the cap: 10,000,000 rows ÷ 288,000 rows per day = 34.7 days, so the full month fits with margin.

Now take 500 tags at 1 Hz: 500 × 86,400 seconds per day = 43,200,000 rows per day. Days to the cap: 10,000,000 ÷ 43,200,000 = 0.23 day, about 5.6 hours. The cap is gone before a shift ends.

Inverting the arithmetic gives the sustainable rate: 10,000,000 ÷ (30 days × 86,400 seconds per day) = 3.9 rows per second across all tags. Spread over 500 tags, each tag may store about one row every 86 minutes. If your process talks faster than that, keep only deadband changes at the Edge and push the full rate to the central historian — and check the logging trigger first, because the 10-second sampling behavior in Ignition tag history shows how the trigger, not the scan rate, decides what actually lands.

Decision: size by rows, not weeks; below roughly 4 stored rows per second the month holds, above it the Edge is the wrong place for the volume.

When does remote tag history beat a custom message API? #

For trends, native remote tag history over the Gateway Network beats a custom API every time: it is configured rather than coded, it respects the central historian's retention and pruning, and it keeps query definitions out of scripts you maintain.

The architecture: a remote tag provider on a gateway points at the central historian, and history queries resolve through it over the Gateway Network. The details of querying are covered in querying tag history from a remote tag provider, and the direction where Edge tags flow to the main gateway is covered in pulling Ignition Edge tags to the main gateway with a remote tag provider. Secure the connection with TLS and two-way certificate authentication.

Bound the chart request to the display task. An example overview request uses a return size of 100 with the MinMax aggregation mode, then a tighter query when the operator zooms into a smaller range. MinMax keeps the extrema inside each interval, so the trend does not smooth away a spike that an average-only trend would hide. Verify the returned point count for your chosen aggregation rather than assuming the requested size is a hard ceiling, and remember no aggregation can recover an excursion that was never sampled or stored.

What should you decide for each requirement? #

Pick local Edge history for short trends, the remote tag provider for long trends, and a named-query message API only for reading application tables such as work orders or batch records — never for operator-issued SQL.

Requirement Where it executes Decision
Display live values at the machine Edge local tags Use Edge as designed; no SQL involved
Trend recent history Edge local history inside the row cap Log with deadband; verify the oldest served timestamp
Long-term trend from the central historian Central historian via remote provider Configure the remote provider; no custom code
Read application rows (work orders, batch records) Named query on the full gateway Build the sendRequest API, or run that screen's project on a full gateway
Operator-issued arbitrary SQL Nowhere appropriate at Edge Run the client against a full Ignition gateway instead

The closing decisions: an Edge gateway never runs SQL, with or without a central gateway behind it. For trends, the remote provider gives you the central historian with configuration only. For application rows, the sendRequest message API is legitimate but is an interface you own — build it once, keep it narrow, and hold the SQL, the credentials and the row limits on the central gateway. For anything that needs real database access from the screen, the answer is a full gateway, not more Edge.

Questions asked

What is the difference between system.util.sendMessage and system.util.sendRequest?

sendMessage sends a message and does not wait for a reply. sendRequest sends one and expects a response returned to the calling script, and sendRequestAsync does the same without blocking the script while it waits. All three target a message handler configured on the receiving gateway, so any of them can carry a request to the central gateway and bring the result back to Edge.

Why does a SELECT in the Designer query tool stop at 1000 rows?

The Designer database query browser limits SELECT results to 1000 rows by default so queries return quickly. That limit belongs to the design-time tool, not to the gateway or the query itself. Run the same query from a script, or raise the limit in the tool, when you need the full result set.

Does the Edge gateway itself ever touch the historian database?

No. History from an Edge gateway is stored and queried on the gateway that holds the historian. The Edge side logs tags locally and fetches older ranges over the Gateway Network through its remote provider. Keep the historian database connection, its account and its pruning on the central gateway.

Do I need an Edge Compute license for gateway-to-gateway messaging?

Discussions of this architecture name Edge Compute as the likely requirement, but entitlements are edition-specific and change between releases, and no edition matrix is reproduced here. If the message API is central to your design, get the entitlement confirmed against your installed Edge edition before you write the first handler.

Keep reading

  • Troubleshooting

    Remote tag history stops when gateway redundancy fails

    A running Gateway Network connection proves the transport, not the services behind it. In the reported case the redundant pair hosting the history providers had detected thread deadlocks on the backup and a disconnected redundancy peer on the primary after a direct upgrade to 8.3.4, so gateway and redundancy health must be restored before any remote provider is reconfigured.

    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

  • Troubleshooting

    Why an Easy Chart pen shows no historian data

    A live tag with an empty Easy Chart pen is a historian write-path fault, not a tag fault. Clear the SQL Server no count option first; if it is already off, remove the trigger or procedure statement that makes the update return a result set, then let the store-and-forward cache drain.

    Edge computing and IIoT

Log analog millivolt signals as booleans in Ignition