I have a content type and some nodes. I am displaying latest 10 nodes from these content type through views block display. Is there any benefit if i add a custom SQL query to display latest 10 items. I will use the same SQL query that i got from view.
Another module to consider for situations where views "might need some help" is Forena (disclosure: I'm a co-maintainer of it). Here is a quote from one of its community docu pages, i.e. Reasons for considering Forena:
"Why not use views instead of forena?" ... The answer is generally something along the lines of "Most forena users love views, views is great! If you want to report against external data though, or you want to do aggregation or analytics, Forena is much more suited to address these requirements."
And since this question is about blocks also, you may want to take advantage of the Forena integration with the Bean module. Here is a quote about that module, its project page:
Think of a Bean as a method to provide new types (compared to node this would be a content type) which then provides an add content interface to create as many blocks as you require (see screenshot below). The bean content can then be placed around the site just like any other block.
You may also want to look at my answers to these somehow related, I think, questions:
Not really. you should stick to using Views; it will provide you more benefits. To name a couple:
- Less custom code to maintain; it's one of the mostly heavily used modules and will be part of D8 core. There's much less worries of security holes, bugs, etc.
- The versatility of the Views features: caching, multiple view displays, filtering, a UI to change all this, etc.
I'd say the only exception to this would be the instances where your query is going to be hit very often, in which case you'd might be able to squeeze more performance out of an optimized SQL query.
For your needs, a block of 10 latest nodes, views will do everything you need it to, not be a burden on performance, and will take much less time to complete than creating & maintaining possibly bug ridden custom code.