Database indexing and keys

I was wondering, when using the Inductive Automation software and running queries on Microsoft SQL I know that you can setup indexes and such in SQL. But a DB programmer asked me if in your software you have to call the index in order to use it.


select runtime from prodtrak where machine = 1 and shift = 1

Now if in the Studio Manager for SQL you have an index set up that indexes machine and shift. Do you have to call the index in this query using the INDEX BY statement or does your software automatically know to use the index if available?

Thanks and have a great day.

I’ve never heard of an “INDEX BY” clause. Our software is not aware of the presence of any indexes, and certainly doesn’t specify to use them or not. Using indexes to optimize query performance is purely in the database’s domain.