Mutlilevel page list in CodeIgniter
One general comment -> YOU ARE NOT ESCAPING $id_menu IN YOUR SQL QUERY!

There is a section on how to do this in the CodeIgniter Database Query Documentation.

I'm not familiar with Code Igniter but there is nothing obvious that jumps out at me as to why this would be slow.