Changes between Version 30 and Version 31 of DeveloperGuidelines/Optimisation


Ignore:
Timestamp:
06/18/10 08:05:01 (11 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Optimisation

    v30 v31  
    8989  These "rules" might seem a matter of course, however, sometimes you need to take a second look at your code:
    9090
    91  1. '''Use joins''' - one complex query is usually more efficient than multiple simple queries (and gives the DB server a chance to optimize):
     91 1. '''Use joins''':
     92
     93One complex query is usually more efficient than multiple simple queries (and gives the DB server a chance to optimize):
    9294
    9395{{{
     
    108110 2. '''Ask exactly for what you expect''' (=limit your query):
    109111
    110     - if you expect only one result, then limit the search by limitby:
     112If you expect only one result, then limit the search by limitby:
    111113
    112114{{{
     
    120122}}}
    121123
    122     - if you need only certain fields of a record, then don't ask for all:
     124If you need only certain fields of a record, then don't ask for all:
    123125
    124126{{{
     
    132134}}}
    133135
    134  3. '''Don't ask twice for the same record'''. Look down your code whether your need the same record later on again:
     136 3. '''Don't ask twice for the same record'''.
     137
     138Look down your code whether your need the same record again later:
    135139
    136140{{{
     
    149153}}}
    150154
    151   4. '''Don't loop over queries''', if you can avoid id. Sometimes it is not as easy to see as in the following example:
     155  4. '''Don't loop over queries''', if you can avoid id.
     156
     157Sometimes it is not as easy to see as in the following example:
    152158
    153159{{{
     
    166172----
    167173DeveloperGuidelines
     174DeveloperGuidelines