I will probably catch some reaction to this, but I found that when you reach the top of the huge collections in Magento, you can do one of two things.
You can...
- Throw money on your hosting solution for more ram / processors / etc
- Use direct sql reads
Using sql reads is not particularly dangerous, since you are not going to try to translate something into a highly managed database using code that has not been fully tested. Your chances are pretty subtle. Yes, there is a chance that everything may go wrong, but you need to weigh the costs / benefits of using a trick like this, which is great for your particular case. It still uses the Magento sql interface, not the user interface.
Modify the following code to list entities or whatever you want to find and use the THAT result to create the collection.
// Just in case ---$mysqli = Mage::getSingleton('core/resource')->getConnection('core_write'); $mysqlr = Mage::getSingleton('core/resource')->getConnection('core_read'); $sql = "select * from some_entity_table where some_column = 'somevars'"; $results = $mysqlr->fetchAll($sql); echo "<PRE>"; foreach ($results as $res) { var_dump($res); }
source share