« Return to Thread: Performance: is better a node_load or a direct SQL query ?

Re: Performance: is better a node_load or a direct SQL query ?

by Damien Cirotteau-5 :: Rate this Message:

Reply to Author | View in Thread

Or you can use a view that return only the required fields. It is a
good compromise between custom query and full node load.

In term of performance, nothing will beat custom SQL query. But this
is worst in term of maintainance and portability. If you do direct SQL
query be sure to use the CCK API to get the name of the tables and
fields. Otherwise you will be in trouble if the CCK tables structure
change (which can happen very easely if you decide to share a field
among several content types or set it to multiple *after* you have
written your own queries).

Damien Cirotteau
Rue89
http://www.rue89.com
+33 1 55 25 74 96
dcirotteau@...
====================================
Pour soutenir Rue89 : http://mur.rue89.com/
====================================



On Thu, Jul 2, 2009 at 12:20 PM, Michel Morelli<michel@...> wrote:

> Hi all. I have a content type with 15+ fields. In some situations I need to
> retrieve only 3 fields.
> So, is better (perfomance, security, portability, etc etc) a call to
> node_load() function or a direct SQL query on the right table ?
>
> M.
>
> --
> Michel 'ZioBudda' Morelli                       michel@...
> Consulenza sistemistica in ambito OpenSource.
> Sviluppo applicazioni web dinamiche (LAMP+Ajax)
> Telefono: 0200619074
> Telefono Cell: +39-3939890025 --  Fax: +39-0291390660
>
> http://www.ziobudda.net                         ICQ: 58351764
>  http://www.ziobuddalabs.it                      Skype: zio_budda
> http://www.ziodrupal.net                        MSN: michel@...
>                                                                  JABBER:
> michel@...
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
--
[ Drupal support list | http://lists.drupal.org/ ]

 « Return to Thread: Performance: is better a node_load or a direct SQL query ?