Friday 23 July 2021
  • :
  • :

Making Magento 2 Faster: Caching and Indexing

You will learn about the caching and indexing used in Magento 2 by magento customization professionals to provide faster data look ups. You can read this post and find how to activate features to avail benefits.

Magento customization faster with caching and indexing

Databases are like buckets, eventually with use they will fill up. The more data in a database the longer it will take to find. Magento 2 uses the database to process checkouts, show pages, and display product information. With all of that going on in a production environment with active users, increasing orders, and product sets your site will slow down over time. Thats where extended features like indexing and caching come in.


Businesses grow in terms of product offerings and saved customer data. All of that data, while great for business, can hurt the business. However, to improve performance Magento 2 uses indexed tables to provide faster data look ups. To take that a step further you can take advantage of the Flat Table option in Magento 2.This option flattens the products and categories into one table to increase speed.

To enable this feature:

1. Login into your admin area.
2. Go to stores > configuration > catalog
3. Under Storefront go to configuration then catalog.
4. Select Yes for both Use Flat Category and Use Flat Catalog Product
5. Save.

After these steps you will need to reindex the database.

Reminder: To reindex the database connect via ssh to your Magento 2 installation. The command is: php/bin magento indexer:reindex.

The indexer rebuilds all the information.

Important note: Tasks like indexing can be automated by a cron job. A cron job is a timed process that runs at a predetermined timeframe. You can set your indexers to run when you want them.


There are two parts to a Magento 2 installation; the database and the application. Indexing covers the database. Caching covers the application. This will increase the visitors access to the frontend.

To enable caching you can do it in two ways; through the admin area or the terminal.
For the admin area go to system > cache management. You can either clear the cache or refresh it.

Important note:

On this screen there is a button that as a novice you may want to stay away from.It is called, Flush Static Files Cache. If you press this button you will have to go aack into the server and deploy your content.

For the terminal go to the bin directory and type php magento cache:enable

With both the indexing and caching portions complete feel confident in knowing that your data and templates are well organized.

Though Magento customization services requires skills and years of experience to deliver exact output as expected by client, still you can enhance the process of customization with caching and indexing option. In this post, professionals have shared details on caching and indexing that one should know for better customization.

Vijay is a compulsive blogger who likes to educate like-minded people on various new technologies and trends. He works with Aegis SoftTech as a software developer and has been developing software for years. Stay Connected to him on Facebook and Google+.