Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Performance question
  • Hi guys,
    I'm converting some sites I create before in FuelPHP: I love it, it's very simple and improve my work so much!
    But I don't know "how good" is an intensive use of ORM features, so I hope someone can explain me... It is possible to use ORM features on a site with large number of records and many ORM connections? Or is it better to use ORM only with small site? Thanks!
  • I answered a similar question recently here: http://fuelphp.com/forums/topics/view/5600#5627 And Phil Sturgeon wrote a full blog on the topic: http://philsturgeon.co.uk/blog/2011/06/misconceptions-about-orms
  • Thanks, the articles looks great!
  • Hi Jelmer, I read those articles but I have one question: I know that with ORM we have worst performance, but I think is very useful when you have to crate a large site. So: when i have to use it? When I have many records? When I have a section with so many connection? What I what to learn is how to recognize the "line" between ORM and simple SQL.
  • There is no "line" as such. Also to say that an ORM will give you "worst performance" is just bullshit. Yes, it's slower than plain SQL. But it can easily be faster than any model that got too fat because every single possible query is in there specificly. And it'll be loads better than anything that was overoptimized without using DRY principles and ends up in uneditable spagetti code. The Orm doesn't care how many object (rows) are in your database, that is about the scaleability of your DB engine and has nothing to do with Orm performance. The number of queries is up to you as well, as Phil argued it's important to understand how an Orm works in order to use it effectively. When it does matter is when you're loading a huge amount of records into runtime at one time, thus I wouldn't use the ORM for displaying a page with 1000 records - but up to about a 100 records should be fine (assuming they don't have big binary or gigantic textfields).
    Easily the most taxing part of the ORM is object hydration: putting the database data into model instances, which is why a big number of records in runtime will take up both more time and memory than just fetching it from the database and using the result directly (logical as that's what the Orms starts with and does some stuff on top).
  • Thank you very much, I've understand what does ORM does.
    Great explanation. Reading your answer I understood that I have to move my vision from model to the entire database system. Thanks ;)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion