Collection and select

Sometimes you need to get a lot of information from the database and you need it fast. The way to get this information normally would be to use the Magento collection for the model. It would look like this: 1 2 3 4 5 6 7 $collection = Mage::getModel('customer/customer')->getCollection() ->addNameToSelect() ->joinAttribute('billing_city', 'customer/city', 'default_billing', null, 'left'); foreach ($collection as $customer) { // Use $customer } The problem with this way of getting the information is that it loads all customer information into memory, which can take a long time when you have many customers....

May 27, 2017