MySQL Forums
Forum List  »  PHP

Re: many to many relationships and PHP
Posted by: Rick James
Date: May 09, 2009 09:43PM

please provide
* SHOW CREATE TABLE tbl\G
* SHOW TABLE STATUS LIKE 'tbl'\G
* EXPLAIN SELECT ...\G
and surround them with [ code ] and [ / code ]

In particular, is this MyISAM or InnoDB? The index handling is quite different between them.

In your relationship table, it is optimal to have both
INDEX(book_id, author_id)
INDEX(author_id, book_id)
because you will probably be starting with a book in some cases; starting with an author in the other. (The optimal details differ between the engines.)

Options: ReplyQuote


Subject
Written By
Posted
Re: many to many relationships and PHP
May 09, 2009 09:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.