I have a Drupal System which is running fine in production and locally but the dev/cons Db seems to have a problem. After looking a bit deeper into it I found that menu_tree_check_access takes 3.8 Sec to finish!
First I thougt there must be something wrong with the DB-Server but everything is fine there.
After I started a node permissions rebuild everything was suddenly quick again. But after the node permissions rebuild finished it was slow again. So I guess there has been added some strange test content that creates some kind of infinite loop or something else.
Any ideas how to debug this? How can I run the slow query against another fresh DB from Prod e.g. with devel I only see the query with placeholders.