[development] Guidelines for writing efficient SQL code

Jean-Michel Pouré jm at poure.com
Wed Aug 26 08:02:29 UTC 2009

Le mercredi 26 août 2009 à 02:25 +0200, Gerhard Killesreiter a écrit :
> Your "tips" are mostly garbage. They may help certain queries under
> certain RDBMSses, but are not generally applicable.

I am removing specific MySQL and PostgreSQL information:

First page gives information about misleading Drupal stats:

Second page is a short introduction to EXPLAIN ANALYSE:

Third page is an introduction to using 
LEFT JOINs in place of INNER JOINs:
(I don't believe that INNER JOINs are faster than LEFT JOINs because an
INNER JOIN removes NULL values and thus processes using sequential scans

Indexes on dual fields may result in slow queries

Avoid Distinct on JOINS whenever possible
Avoid using DISTINCT in JOINs whenever possible and write straight JOINs

Kind regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Ceci est une partie de message num?riquement sign?e
URL: <http://lists.drupal.org/pipermail/development/attachments/20090826/4bbab730/attachment.pgp>

More information about the development mailing list