[support] Performance: is better a node_load or a direct SQL query ?

Damien Cirotteau dcirotteau at rue89.com
Thu Jul 2 10:29:48 UTC 2009


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 at rue89.com
====================================
Pour soutenir Rue89 : http://mur.rue89.com/
====================================



On Thu, Jul 2, 2009 at 12:20 PM, Michel Morelli<michel at ziobuddalabs.it> 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 at ziobuddalabs.net
> 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 at ziobuddalabs.it
>                                                                  JABBER:
> michel at ziobuddalabs.it
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>


More information about the support mailing list