Nav menu items are posts of the type nav_menu_item. They are combined to a nav menu by an assigned term from the taxonomy nav_menu. Each nav menu is a collection of posts under a term.
The function wp_get_nav_menu_items() is probably the best start to explore this.
- The tables
{$prefix}_termsand{$prefix}_term_taxonomyare queried for the current nav menu. {$prefix}_term_relationshipsand{$prefix}_term_taxonomyare queried to find the posts assigned to that menu (term).{$prefix}_postsis queried to get the posts.{$prefix}_postmetais queried to get the post meta data.
So the data for a nav menu are spread over four tables.
To see all the queries, add the following to your wp-config.php:
define( 'WP_DEBUG', TRUE );
define( 'SAVEQUERIES', TRUE );
The install and activate the plugin Debug Bar, go to a page with a menu and open the debug menu. There is a tab Queries with all the queries WordPress has done for that page.