Whitepaper SQL The Midas Touch
Whitepaper SQL The Midas Touch
SQL
The Midas Touch
Combining the power of SQL with your SCADA system
facilitates more people asking more questions about
your data. The answers can result in immediate,
impactful, potentially revolutionary insights into
whats happening in your company right now.
800.266.7798
www.inductiveautomation.com
White Paper
SQL: The Midas Touch
SQL: The Midas Touch | 2 of 7
2012 Inductive Automation
800.266.7798
www.inductiveautomation.com
Although Midas golden touch might only be the
makings of a legend, the ability to transform the
valueless into the valuable is very real. One such ex-
ample of modern day alchemy exists in the feld of
industrial automation. It is the ability to transform
mundane time-series data into an indispensable
asset through the use of SQL relational databases.
To succeed in business it is important to pursue
every advantage possible. This includes acquiring
more assets as well as fully capitalizing on untapped
assets that a company already possesses. In the
manufacturing industry one of the most underval-
ued and underutilized assets that companies pos-
sess is the time-series data residing in their SCADA
(supervisory control and data acquisition) systems.
Many manufacturing companies view time-series
data as a simple byproduct of using a SCADA system.
They see time-series data as being useful for telling
the status of specifc data points at specifc times,
tracking simple trends ... and little else. Most compa-
nies dont see any value for it beyond that point.
The usefulness of time-series data explodes expo-
nentially when it is put into context with data from
the rest of the enterprise. Time-series data that is
easily accessible and relatable comes alive, ofer-
ing deep insights into interrelationships between
the plant foor and the rest of the enterprise that
can potentially change the fortunes of the entire
company for the better.
Old King Midas could turn anything he touched into gold with the simple
touch of his hand, or so the old story goes. The tale dates back to Greek
mythology, and refects a human aspiration that dates back even further
the desire to change the value of ones fortune.
Time-Series Data
Time-series data is the lifeblood of any SCADA
system. It is a sequence of data points, measured at
successive time instants, and spaced out at uniform
intervals. Time-series data is created when a data
point from a PLC is read and time-stamped by a
SCADA system.
Time-series data is used to monitor machines and
processes connected to a SCADA system, usually
through a PLC. An example of time-series data
would be the weight data coming from a scale on a
production line. As product is weighed on the scale
each weight reading receives a timestamp from the
SCADA system. In the pairing of a piece of data with
a date and time, a time-series data point is created.
Time-series data can be displayed in real time, as
well as logged as historical data. To be logged as
historical data, time-series data needs to be saved in
some kind of repository. This is where SQL databases
come into play.
Turning Time-Series Data
Into Enterprise Gold
The Evolution of Controls Data
PLC
Raw Data Time-Series
Data
Historical
Data
SCADA DATABASE
SQL: The Midas Touch
SQL: The Midas Touch | 3 of 7
2012 Inductive Automation
800.266.7798
www.inductiveautomation.com
SQL: Better for Storing Data
Traditionally, time-series data has been stored in a
process historian, but relational SQL databases ofer
a compelling alternative. SQL databases compare
favorably to process historians and even ofer the
major advantage of making historical data more
accessible to other enterprise systems.
Before getting into a comparison of how to choose
between process historians and SQL relational
databases for storing your data, it is important to
understand some basics about SQL databases
and historians.
SQL Databases: Simple and Accessible
SQL-compatible databases are the most popular da-
tabases in the world, used to store information of all
types in every industry you can imagine. SQL is not
a type or brand of database; SQL is a standardized
structured query language for databases. SQL data-
bases are relational databases, which are structured
like a large spreadsheet with rows, columns and cells,
but are much more robust and powerful.
SQL databases are popular for their simplicity, ease of
connectivity, fexibility and most of all their ability to
quickly query related data. SQL was created with the
specifc intent to make it easy to ask questions of data.
The primary function of SQL is to create a query (or
question) and run it against your data to retrieve an
answer. Simply put, SQL was built to quickly answer
complex questions about large amounts of data.
A SQL database makes a great repository for time-
series data, but despite this, SQL databases are often
ignored. One reason for this is a perception in the
manufacturing industry that time-series data is not
relational data, so therefore it doesnt belong in a
SQL relational database. Regardless of how perva-
sive this idea is, its not true.
Relational data is data that can be related to other
data, and in order to relate things together there
needs to be something in common. In this sense
time-series data is actually inherently relatable
because all time-series data has something in com-
mon a timestamp. The timestamp on all time-series
data means that it can be easily related to any piece
of data that is also associated with a time.
This makes the notion that time-series data is not
relational data simply false. In spite of this, many
companies opt to use a much more expensive
method of storing time-series data than SQL; they
use process historians.
Process Historians: Proprietary and Detached
A process historian is an application specifcally
created to deal with time-series data. A historian is
made for the storage and analysis of time-series data
and as such is designed with an emphasis on the
compression and speedy retrieval of large amounts
of data.
Most historians use proprietary technology to com-
press and store data, which can make it difcult for
other systems to easily communicate with them. As a
result, time-series data is often kept totally separate
and detached from the rest of the enterprise data;
not because it has to be, but because historians
make it difcult for other systems to work with it.
The outcome of this has been a misperception in the
manufacturing industry that somehow time-series
data is special, and can only be handled by a process
historian. In truth, there is nothing special about
time-series data, its just data. A SQL database will
more than sufce for the logging of time-series data.
To explore how SQL can be a golden alternative to
process historians, lets take a look at the selling
points of process historians and how SQL relational
databases stack up to them.
SQL: The Midas Touch
SQL: The Midas Touch | 4 of 7
2012 Inductive Automation
800.266.7798
www.inductiveautomation.com
SQL Databases vs. Process Historians
There are advantages and disadvantages for using
process historians and SQL relational databases. Un-
derstanding the strengths and weaknesses of process
historians will help you make an informed decision
about using SQL to help your company make the
most of its time-series data. SQL databases coupled
with modern SQL-friendly SCADA systems can mea-
sure up and even outdo traditional process historians.
Speed
Historians can log data very quickly, but this comes
at the cost of putting data into a proprietary, fat
fle format that other enterprise systems will have
trouble accessing.
On the other hand SQL has gotten a bad rap for not
being fast enough to log time-series data efectively.
While at one point this may have been the case,
modern SQL databases coupled with state-of-the-
art SCADA systems have no trouble logging 100,000
tags per second and more. This is more than enough
speed to handle most cases.
Size
In the area of fle compression, process historians
have a clear advantage over SQL databases. Histori-
ans do a good job of compressing data to maximize
storage space because that is what they were de-
signed to do. However this compression once again
comes at the cost of having to save data in a propri-
etary, difcult-to-read fle format.
While SQL cant achieve the same compression ratios
that historians can, a SQL database is easily scalable
to accommodate the largest storage needs. Also, with
the cost of memory getting cheaper and cheaper the
space that data takes up is less and less important.
Support
This one is no contest. SQL is clearly more widely
used and well supported than even the most popular
process historians. SQL is used in virtually every in-
dustry on the planet, and as a result, IT professionals
are very comfortable supporting SQL on a daily basis.
All you have to do is go to the bookstore to confrm
this; there are hundreds of books about using SQL
in all kinds of ways. You will be hard pressed to fnd
even a few if any books that support of the pro-
prietary languages that process historians use.
Cost
The advantages of cost go squarely to SQL. The price
for process historians can be outrageously priced at
10 to 30 times the cost of a SQL relational database. It
can cost upwards of $60,000 to get everything work-
ing. Getting a SCADA system set up to log historical
data to a SQL database is a fraction of the cost, and
ofers more advantages.
Analysis
SQL was designed to make it easy to ask questions
of data in whichever way you want by constructing
simple SQL queries. SQL puts the user in the drivers
seat when asking questions.
On the other hand historians were designed to store
data and return quick analysis of pre-built questions.
Historians ofer answers to questions quickly, but
the questions are the ones the historians were built
to answer, which are not always the questions that
need to be answered.
Interoperability
This last one is where SQL really shines. SQL was
made to be easy to connect to, and because SQL
relational databases are the most widely used in the
world, most enterprise systems are already using
them. If your time-series data is logged in a SQL
database, it is a breeze to connect it to other systems,
which means easy interoperability, enterprise-wide.
Since historians save data in a proprietary format
it can be a real challenge to achieve true interoper-
ability with the rest of the data in the enterprise. It
requires the use of a proprietary decoder to con-
vert data into a palatable format, which costs more
money. Standardized interfaces have been devised
using OPC HDA (historical data access), but support
and functionality is limited when compared to SQL.
If your time-series data is logged
in a SQL database, it is a breeze
to connect it to other systems,
which means easy interoperability
enterprise-wide.
SQL: The Midas Touch
SQL: The Midas Touch | 5 of 7
2012 Inductive Automation
800.266.7798
www.inductiveautomation.com
A Penny Saved is a Penny Earned
After a side-by-side comparison of SQL and process
historians, the advantages of using a SQL relational
database to log historical data are pretty clear. SQL
databases are designed to empower users to quickly
get answers to questions while historians are de-
signed to efciently store highly-compressed data.
Both are good at what they do, but when you factor in
the much lower cost of using a SQL database, the value
of using SQL is easy to see. The money saved using SQL
could be put toward other more pressing needs, which
can increase the value of the enterprise overall.
SQL: Better for Real-Time Data
One of the biggest ways SQL can add value to a com-
pany is making information available in real-time. It
accomplishes this by taking out the man-in-the-middle
and putting him to work somewhere else. The-man-in-
the-middle is in reference to the old way of achieving
some semblance of interoperability with time-series
data and the data from other systems in the enterprise.
To relate real-time time-series data with data from
other enterprise systems there are few options for us-
ers who have SCADA systems that dont take advan-
tage of SQL. They have to export data into a fat fle
that must be decoded, and buy an expensive decoder
to make sense of the proprietary fle format, or they
can try to hack a connection, which ofers uncertain
results. Because of these limited options, many com-
panies are still doing things the old-fashioned way.
In order to get time-series to work with other data,
they have someone manually export and decode the
data and then import it into another system this
unlucky fellow is called the man-in-the-middle. SQL
databases remove this step, making your data avail-
able in real time.
Out of the Middle, Into the Lead
Not only is the man-in-the-middle approach really
slow, but the inefectiveness of the approach is com-
pounded when data has to be shared across multiple
systems. This is because the data has to be separately
imported into each system, and this has to be done
every time the company wants to compare real-time
data although after all the exporting and importing,
calling it real-time data is a stretch. All this can be
avoided simply by using SQL for time-series data.
The other systems in your enterprise understand SQL,
so just give them time-series data in a way they can
understand it. Using SQL for time-series data means
that its possible to achieve easy interoperability with
the systems in the rest of the enterprise in real time.
SQL totally eliminates the need for the-man-in-
the-middle, which can free up that employee to
deal with other work that requires attention. It also
means that you can get answers to important ques-
tions about real-time data in milliseconds, not hours
or days. More efective use of manpower means
a greater proft margin, and a less stressed-out,
former man-in-the-middle who can be in the lead
driving the data.
SCADA MES
SQL
ERP
The Man-in-the-Middle
Manually importing data across multiple
enterprise systems can get tiring.
A SQL database cuts out the man-in-the-middle
and gets data to where it needs to be quickly.
The Man-in-the-Lead
d
a
t
a
SCADA MES ERP
d
a
t
a
d
a
t
a
d
a
t
a
SQL: The Midas Touch
SQL: The Midas Touch | 6 of 7
2012 Inductive Automation
800.266.7798
www.inductiveautomation.com
SQL: Total Enterprise Connectivity
There is no question that as technology has pro-
gressed the world has become more and more
connected; and that connectivity has become ever
more important to the proftability of todays busi-
nesses. Not that long ago having a company website
was seen as a luxury, whereas today it is virtually a
requirement to doing business.
As the business world has become more connected,
companies have also increasingly grown interde-
pendent on one another. This has been mirrored in
the manufacturing industry, where companies have
become more specialized and processes have grown
more and more complex.
With so much going on at a modern manufacturing
company every day, it has become imperative to stay
connected with the entire enterprise at all times.
Each system in the enterprise could be afecting the
others for better or worse, and the only way to know
is to get everything connected. Using a SQL database
for time-series data facilitates easy connection to
other enterprise systems because most of them have
used SQL for years.
The time-series data from your SCADA system may
have volumes to say about your company. It may
hold the key to unlocking the true potential of your
companys productivity; it may even be that com-
petitive advantage your company has been seeking.
It may be a lot of things, but if your time-series data
isnt connected to the rest of your enterprise it is
defnitely underutilized.
In order to tap the potential gold mine of informa-
tion contained within your SCADA system, you have
to give the data context. The only way you can put
time-series data into context is to make it relatable to
the data from the rest of your enterprise. Here are a
few examples to help illustrate the potential proft-
increasing benefts of putting time-series data into
context with the rest of your enterprise.
Inventory
System
Warehouse
System
Shipment
System
Downtime
System
Quality
System
SCADA
MES
ERP
Raw Materials
Total Enterprise Connection (use this diagram to reference examples 1 through 3 on the next page)
Processing
Quality
Checkpoint
Final Product
Shipping
Delivery
Lot 1A Lot 2A Lot 1B Lot 2B
Lab
Store 1
Warehouse 1 Warehouse 2
Line 2 Line 1
T
r
u
c
k
2
T
r
u
c
k
1
Store 2 Store 3 Store 4
SQL: The Midas Touch
SQL: The Midas Touch | 7 of 7
2012 Inductive Automation
800.266.7798
www.inductiveautomation.com
Example 1: Inventory + OEE + SCADA
After cross-referencing the time-series data in the
SCADA system with OEE (overall equipment efec-
tiveness) software via a SQL database connection
it is apparent that line 1 is producing more product
than line 2. The OEE software points to the fact that
more downtime is occurring on line 2, which is result-
ing in decreased production. The two lines appear
to be functioning properly, yet line 2 is clearly not as
efcient as line 1.
However, since the inventory system is also connected
to the SQL database it is discovered that line 2 uses
raw materials from a diferent vendor than line 1.
After making a switch of raw material vendors the
productivity of line 2 is increased and the problem
is solved. Solving the problem swiftly because of
enterprise-wide connectivity results in decreased
downtime and increased productivity, which means
increased value for the company on the whole.
Example 2: Quality + SCADA
All products pass through a quality checkpoint
before moving on to packaging; in this process the
quality system is alerted to the fact that numerous
products are falling below acceptable control limits.
Thanks to the SQL connection that the quality and
SCADA systems share, the ofending products can be
traced back through the process to their source.
After tracking several low-quality products back to
the source, it is discovered that the raw materials all
originated from lot 1B. Once the bad lot is discovered
and shut down, the quality of all the products is again
within acceptable levels. Thanks to cross-enterprise
data accessibility, the quality problem was identifed
and fxed before any damage was done, saving the
company time, money and bad publicity.
Example 3: Invoicing + WMS + SCADA
An abnormal amount of complaints are coming in
from a localized area about the freshness of the prod-
uct. By using the invoice system, the shipment made
to the area in question is identifed and traced back
to originating from warehouse 2. After searching
through the data of the quality and SCADA systems,
no problem is discovered.
However the WMS (warehouse management system)
reveals an unusually large gap in time between
when the product was packaged and shipped the
product has begun to spoil by sitting in the ware-
house too long. By discovering the problem quickly,
it can be addressed before more bad product goes
out, minimizing the damage done.
More Valuable in the
Present, Past and Future
Using SQL relational databases to deal with time-
series data makes it accessible to the entire enter-
prise. The bottom line is that combining the power
of SQL with your SCADA system facilitates more
people to ask more important questions about your
data. The answers to those questions in real time can
result in immediate, impactful, potentially revolution-
ary insights into whats happening in your company
right now.
SQL can also help shed new light on past data.
Time-series data that has been collecting dust can
be given new life by putting it into a SQL database.
Putting the data into a relational format will make
old data easy to put into context with the data from
across the enterprise. Its possible that in the light of
this new context you may discover trends that you
have never seen before, trends that could hold the
key to increasing the companys productivity.
In the Information Age in which we live, the value
of accurate, real-time information cannot be over-
stated. As we move into the future, the speed of
business will continue to accelerate and only the
companies that stay quick and agile will be able to
keep up. Using SQL puts a company in a good posi-
tion to keep pace.
Using SQL allows companies to answer important
questions about their data in milliseconds, and in
a competitive industry where every second counts,
that is a game-changer. Pairing SQL and SCADA can
help you turn your time-series data into one of your
companys more useful and valuable assets.
Maybe the Midas
touch isnt a
legend after all.
SQL: The Midas Touch
Connecting to SQL databases ...
1. Open Ignition
2. Click create new database connection
3. Authenticate connection
4. Connect to as many databases as you want
... thats simple!
Thats
Unlock the full power of your SCADA system. Ignition
speaks SQL so you dont have to. You can easily connect
to as many databases as you need, at no extra cost.
Download today at www.TryIgnition.com
HMI
SCADA
MES Software
800.266.7798
www.inductiveautomation.com