简体   繁体   中英

Is there a way to create indices on a Teradata SQL View?

Is it possible to add indices to a View in Teradata? Aiming to make querying of Views faster by adding indices.

Tried using SQL to check for indexes on existing Views by using SELECT * FROM DBC.Indices . Yet there are only results for Tables, none for Views.

I have also been checked internet, but have so far been unable to find anything so far for Teradata.

I would have expected to be able to find an index on some of the existing Views, if it was possible.

An index is always associated with a table (or with multiple tables in case of the Join index), never with a view.

But: the execution plan of a query (and consequently its performance) depends, among other things, on the indices defined on the tables involved in the query.

So while you can't create an index on a view, you can create indices on the underlying tables, and it will change how the queries referring the view are executed.

However, before starting to create additional indices in the hope of fixing your performance problem, you should first inspect the execution plan of the problematic queries and determine what the correct plan ought to look like. The problem might not be the lack of indices, but rather lack of up-to-date statistics, poor queries, or bad table design (eg wrong PI or poor partitioning).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM