Changes between Version 31 and Version 32 of DeveloperGuidelines/Optimisation


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

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Optimisation

    v31 v32  
    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''':
     91=== Use Joins ===
    9292
    9393One complex query is usually more efficient than multiple simple queries (and gives the DB server a chance to optimize):
     
    108108}}}
    109109
    110  2. '''Ask exactly for what you expect''' (=limit your query):
     110=== Limit your Query ===
    111111
    112 If you expect only one result, then limit the search by limitby:
     112Ask exactly for what you expect - if you expect only one result, then limit the search by limitby:
    113113
    114114{{{
     
    134134}}}
    135135
    136  3. '''Don't ask twice for the same record'''.
     136=== Don't ask twice... ===
    137137
    138 Look down your code whether your need the same record again later:
     138...for the same record. Look down your code whether your need the same record again later:
    139139
    140140{{{
     
    153153}}}
    154154
    155   4. '''Don't loop over queries''', if you can avoid id.
     155=== Don't loop... ===
    156156
    157 Sometimes it is not as easy to see as in the following example:
     157... over queries if you can avoid id. Sometimes it is not as easy to see as in the following example:
    158158
    159159{{{