2

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

2

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.

Categories

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

Products

if (Mage::helper('catalog/product_flat')->isEnabled()) {
1
  • 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? Oct 11, 2013 at 19:12

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.