This question already has an answer here:

load by Id

$data = Mage::getModel('module_name/model)->load($id);


//collection by filter

$data = Mage::getModel('module_name/model)->getCollection()->addFieldToFilter('id',$id);

marked as duplicate by Raphael at Digital Pianism, Amit Bera, Fabian Schmengler, 7ochem, Qaisar Satti Aug 22 '16 at 11:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Welcome to Magento SE. The question already has been asked, so I answered it in the duplicate linked above. TL;DR: It depends what you need because both give different results – Fabian Schmengler Aug 20 '16 at 19:59

The proper method to get single record : Mage::getModel('module_name/model)->load($id);

If you use getCollection() then it will load all the record of that particular table and then it will filter the record from all collection.

While load() will fetch only single record from that table.

  • Thanks for prompt reply. Is there any way to calculate load time of both queries in magento? – Vishal Aug 20 '16 at 6:49
  • Calling a collection does NOT load each item. Each record will be contained within the collection but ->load() is not called on each object and as such the object is not actually loaded. However, you are correct that loading a single record by ID is the most efficient way. – Shawn Abramson Aug 20 '16 at 6:54
  • @Vishal you can use xdebug's profiler to determine memory and time calculations. – Shawn Abramson Aug 20 '16 at 6:56
  • You can use this extension to get all query time detail. mgt-commerce.com/magento-developer-toolbar.html – Ashish Jagnani Aug 20 '16 at 6:56

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