This tutorial will show you how to enable Flat Catalog in Magento Templates.
Flat Catalog will help you to speed up your product collection instead of managing the catalog data in many tables by the Entity Attribute Value (EAV). When your store applies the Flat Catalog, the new tables are generated on the fly and store the necessary data related to your product or category.
In order to enable it, navigate to the Stores > Settings > Configurations section in your admin panel.
Select Catalog on the left panel, under the Catalog.
Open the Storefront section there.
Choose "Yes" at the Use Flat Catalog Category and Use Flat Catalog Product fields.
Press the Save config button to save the changes.
That is the end of the tutorial. Now you know how to enable flat catalog for your store.
Feel free to check the detailed video tutorial below:Magento 2. How to Enable Flat Catalog