2

Mysql has known limitation of 61 tables to join, how do you overcome that when you have more than 61 attributes to join in magento collection?

1
  • 1
    What are you doing? Do you join a lot of attributes? Or what does this query selecT? Sep 6 '13 at 13:14
12

There's no circumventing, however, you don't always need a join. If custom tables are involved, denormalize them. Serialize some data into JSON/PHP serialized objects.

You can also use UNION to merge multiple SELECT statements. You can use subqueries, and you can use multiple, sequential, queries to append to a custom collection.

In short, rethink your design or your implementation.

Other thoughts:

Or look into Magento's compatibility with other RDBMS' such as SQL Server or Oracle. Look into the specs of MariaDB, the fork of MySQL to see if it's compatible. See if there's some community support (not sure off the top of my head) for Postgres in Magento.

3
  • 1
    +1. I like this more than my blunt "You can't" answer.
    – Marius
    Sep 6 '13 at 13:56
  • I like your +4 upvotes better than my 1. :)
    – philwinkle
    Sep 6 '13 at 13:57
  • 1
    wait for it....it will grow...and by the way, you can make my +4 to +3 :)
    – Marius
    Sep 6 '13 at 13:58
7

Well...you can't. Since this is a limitation of MySQL you cannot go around it with Magento. What you can do is to rethink your business logic, to have less than the max number of join tables and get the rest of your data in an other way (different query). I know this means more queries, but at least it works.

3

You could write a custom Magento indexer to track the attributes in a single flat index table, which would have the side benefit of being a lot more efficient on the db level. Take a look at

Mage_Catalog_Model_Product_Indexer_Flat

to see how Magento deals with this EAV problem feature in core.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.