first sql optimization: fetch countOthers() for all bookmarks at once instead of each single
This commit is contained in:
parent
aca27618d0
commit
57cafb6d79
@ -217,6 +217,12 @@ if($currenttag!= '') {
|
|||||||
id="bookmarks">
|
id="bookmarks">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
$addresses = array();
|
||||||
|
foreach ($bookmarks as $key => &$row) {
|
||||||
|
$addresses[$row['bId']] = $row['bAddress'];
|
||||||
|
}
|
||||||
|
$otherCounts = $bookmarkservice->countOthers($addresses);
|
||||||
|
|
||||||
foreach ($bookmarks as $key => &$row) {
|
foreach ($bookmarks as $key => &$row) {
|
||||||
switch ($row['bStatus']) {
|
switch ($row['bStatus']) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -261,7 +267,7 @@ if($currenttag!= '') {
|
|||||||
|
|
||||||
// Udders!
|
// Udders!
|
||||||
if (!isset($hash)) {
|
if (!isset($hash)) {
|
||||||
$others = $bookmarkservice->countOthers($row['bAddress']);
|
$others = $otherCounts[$row['bAddress']];
|
||||||
$ostart = '<a href="'. createURL('history', $row['bHash']) .'">';
|
$ostart = '<a href="'. createURL('history', $row['bHash']) .'">';
|
||||||
$oend = '</a>';
|
$oend = '</a>';
|
||||||
switch ($others) {
|
switch ($others) {
|
||||||
|
Loading…
Reference in New Issue
Block a user