Changes between Version 30 and Version 31 of DeveloperGuidelines/Optimisation
- Timestamp:
- 06/18/10 08:05:01 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/Optimisation
v30 v31 89 89 These "rules" might seem a matter of course, however, sometimes you need to take a second look at your code: 90 90 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 93 One complex query is usually more efficient than multiple simple queries (and gives the DB server a chance to optimize): 92 94 93 95 {{{ … … 108 110 2. '''Ask exactly for what you expect''' (=limit your query): 109 111 110 - if you expect only one result, then limit the search by limitby:112 If you expect only one result, then limit the search by limitby: 111 113 112 114 {{{ … … 120 122 }}} 121 123 122 - if you need only certain fields of a record, then don't ask for all:124 If you need only certain fields of a record, then don't ask for all: 123 125 124 126 {{{ … … 132 134 }}} 133 135 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 138 Look down your code whether your need the same record again later: 135 139 136 140 {{{ … … 149 153 }}} 150 154 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 157 Sometimes it is not as easy to see as in the following example: 152 158 153 159 {{{ … … 166 172 ---- 167 173 DeveloperGuidelines 174 DeveloperGuidelines