Enable Flat Product and Category Tables in Magento
To enable flat table support in Magento, go to System > Configuration > Catalog > Frontend in your administration dashboard.
Change the Use Flat Catalog Category and Use Flat Catalog Product settings to Yes and click the Save button.
In Magento 2+, edit vendor\magento\module-catalog\etc\config.xml
to set flat_catalog_category system value.
After enabling the settings, go to System > Index Management and update the flat data indexes.