Fix Slow Views Queries by Adding Indexes

The Views module is a powerful tool to build custom database queries and style the results. But the Views UI does not always produce the most optimal query. Especially, it does not add appropriate table indexes (at the MySQL schema level) to improve performance.

If you are using many Views queries, it would be a very good idea to analyze the queries. Improve performance by adding sensible indexes. There is module out there, DB Tuner, which helps you both identify slow views queries as well as suggest indexes, which you can add with a few clicks.

Ultimately, you may need to think through what you are trying to achieve. Sometimes removing the View is better, or replacing it with a simpler query.

Advantages

  • Improve MySQL performance, query performance

References