How to Enable Flat Catalog in Magento 2

Enabling Flat Catalog is recommended for enhancing the performance before versions 2.3.x

and here are the steps to enable it.

Please read this article Flat catalogs 

If you use Magneto 2.2 or less

You can activate the flat catalog for categories and products:

  • On the Admin Panel, Stores > Settings > Configurations.
  • On the left panel, under Catalog, select Catalog.
  • Open the Storefront section,
    • Choose Yes in the Use Flat Catalog Category field.
    • Choose Yes in the Use Flat Catalog Product field.

  • Save Config to complete.
  • When you see a system message about the cache update, tap the Cache Management link to flush the cache.

If your Magento store has too many attributes you may counter this issue when you try to make reindex please read this article to solve the issue. Issue: Product flat table will not reindex – Row size too large