User Guide > Performance Tuning > Use Indexes, and Primary and Foreign Keys, to Improve Query Performance
 
Use Indexes, and Primary and Foreign Keys, to Improve Query Performance
Indexes can speed up searching or retrieving data from a database table. Identifying indexes and primary keys enable the TDV Query Engine to use logical algorithms for faster, more efficient joins.
Typically, when an index is created for a column, all data in that column is scanned and a data structure (index) is constructed; the index makes the data in that column faster to lookup, although indexing also can slow transactions that insert rows into the tables. The contents of the index are automatically updated whenever the data in a row are modified.
In Studio, the Indexes panel in the view and table editor lets you create metadata labels for indexes and primary keys already present in the data source. In Studio, the Foreign Keys panel in the view and table editor lets you create a definition that uses any foreign keys present in the data source.
TDV does not build a specified data structure, but creates a metadata definition that lets you take advantage of the existing resource’s data structure. Queries and joins do not necessarily run faster because of an index. The metadata index and key specifications are not validated, so there is no guarantee that a column marked as a primary key has unique values.
Clients of the TDV Server can benefit from knowledge of indexes and primary keys feature because this information is made available when the data service is published. More sophisticated client programs can generate efficient queries based on column indexes and primary keys.
In some cases, TDV cannot automatically determine what columns of a view are indexed. For example, a column might be a primary key in the base table. But in the view, the value might not qualify as a primary key.
For information on how to create an index for a table or view in Studio, see Defining Primary Key for a View or Table in the Indexes Panel.