Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I add an index on a view in mariaDB

Tags:

sql

mariadb

I need to create an index on a view in mariaDB. Is this possible?

Note that, I can't create an index on tables since admininstrator permissions are not given to access tables.

like image 425
KancTerc Avatar asked Mar 27 '19 08:03

KancTerc


People also ask

Can we CREATE INDEX on view in MariaDB?

No, you cannot create indexes on a View in MariaDB. Indeed, Views are not real relations, but simply aliases on relations (tables). You could have created indexes on a Materialized View but MariaDB does not implement (in a native way) Materialized Views as of today.

Can you put an index on a view?

Views make queries faster to write, but they don't improve the underlying query performance. However, we can add a unique, clustered index to a view, creating an indexed view, and realize potential and sometimes significant performance benefits, especially when performing complex aggregations and other calculations.

Can you add indexes to a view mysql?

It is not possible to create an index on a view. Indexes can be used for views processed using the merge algorithm. However, a view that is processed with the temptable algorithm is unable to take advantage of indexes on its underlying tables (although indexes can be used during generation of the temporary tables).

Can you put an index on a view in SQL Server?

To enhance the performance of such complex queries, a unique clustered index can be created on the view, where the result set of that view will be stored in your database the same as a real table with a unique clustered index.


1 Answers

No, you cannot create indexes on a View in MariaDB.

Indeed, Views are not real relations, but simply aliases on relations (tables).

You could have created indexes on a Materialized View but MariaDB does not implement (in a native way) Materialized Views as of today.

like image 92
Nicolas Payart Avatar answered Oct 17 '22 20:10

Nicolas Payart