[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:
http://drupal.org/node/559302

First page gives information about misleading Drupal stats:
http://drupal.org/node/559320

Second page is a short introduction to EXPLAIN ANALYSE:
http://drupal.org/node/559720

Third page is an introduction to using 
LEFT JOINs in place of INNER JOINs:
http://drupal.org/node/559474
(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
internaly)

Indexes on dual fields may result in slow queries
http://drupal.org/node/555558

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

Kind regards,
Jean-Michel
-------------- 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