When someone runs a query directly on the database and this query takes 7secs, the megamenus have nothing to do.
To start, 1M products are too many for a database like mysql. Also i suspect some indexes may missing. But if your product page takes that much to load then stop the project, sit back and think what you trying to do and if this will be ever easily fixed. Catalog pages are far far more heavy, product page is quite simple if done correctly.
Finally, from the answers i see that there is 0 knowledge of web app development. Most see magento as a black box that you change a setting and all magically fixed. I cant understand how you base your business on 0 knowledge.