When you guys are doing mysql joins on product and category collections how do you plan/deal with the differences in eav and flat collection?

The main thing i see is that eav using 'e' for the column name whereas flat uses main_table.

Am i correct in stating that to have a single join work in both situations I must check first if flat is enabled in order to provide the correct collumn name?

Or am i not understanding something correctly?

1 Answer 1


Alan does a good job explaining this:

Be careful if you are including EAV data into your flat collection as you'll notice a performance drop. It is best to include the data you are needing as apart of the flat catalog indexing.

In short, checking the helpers before hand and conditioning your collections then.


 if (Mage::helper('catalog/category_flat')->isEnabled()) {


if (Mage::helper('catalog/product_flat')->isEnabled()) {
  • So to confirm, your advice is to when preparing a join on one of these collections is to check first using the helper and the construct the join specifically based on the flat tables status? Commented Oct 11, 2013 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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