I am little bit confuse. I am using magento orm basic like Mage::getModel('test/test') and I search that also use direct SQL query use for insert,update and delete so my question is which one is better and if I use direct SQL query so any arise security issue in future or secure direct SQL query in magento ? Which one is better both of them ? Please guide me

1 Answer 1


There is no problem about using direct SQL queries, if you are 100% sure which database tables you'd read or update. Most common issue here would be missing some tables to update, leading to data inconsistence

Using Magento models performs slower, but you don't have to mind which database tables might be involved in your operation

  • Given Magento's EAV structure, it's really easy to corrupt the database if you don't do your homework when you create your direct SQL data inserts. Commented May 16, 2016 at 3:35

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.