Bug #8087
performance improvement
| Status: | Accepted | Start date: | 2011-02-06 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | 2011-02-18 | |
| Assignee: | Stefan Busemann | % Done: | 0% |
|
| Category: | Listview | |||
| Target version: | - | Estimated time: | 1.00 hour | |
| Votes: | 0 |
Description
You could increase performance by changing class "tx_wtdirectory_pi1_list"
add this declaration to the class
var $resultCount = NULL; //initialize variable
and change the function "overall" like this
@
if ($this->resultCount === NULL) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( // DB query
$this->query['select'] = 'tt_address.uid',
$this->query['from'] = 'tt_address LEFT JOIN tt_address_group_mm on (tt_address.uid = tt_address_group_mm.uid_local) LEFT JOIN tt_address_group on (tt_address_group_mm.uid_foreign = tt_address_group.uid)',
$this->query['where'] = $this->filter . $this->query_pid . $this->query_cat . $this->cObj->enableFields('tt_address'),
$this->query['groupby'] = '',
$this->query['orderby'] = '',
$this->query['limit'] = ''
);
$this->resultCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res); // numbers of all entries
}
if (!empty($this->resultCount))
return $this->resultCount;
@
This should be faster with lot of entries. Because:
I. fetching only one column instead of all (tt_address.uid instead of *)
II. Groupby for auto-inc collumn could be skipped (I don't know how this would influence the result? You could use "SELECT DISTINCT" instead, because only the number of matches is important. And grouping is pretty slow, I think.)
III. Using a class variable to save the number of matched entries could be used only executed once (actually twice called in the code)
I attached my patched file to this issue.
History
Updated by Stefan Busemann over 2 years ago
- Due date set to 2011-02-18
- Category set to Listview
- Status changed from New to Accepted
- Assignee set to Stefan Busemann
- Target version set to 1.4
- Start date changed from 2010-06-07 to 2011-02-06
- Estimated time set to 1.00
Updated by Alex Kellner almost 2 years ago
- Target version deleted (
1.4)