mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Profiler/Completions
* add keyed col `exalted` to reputation completions table to speed up lookups
This commit is contained in:
@@ -102,7 +102,7 @@ class FactionBaseResponse extends TemplateResponse implements ICache
|
||||
// profiler relateed (note that this is part of the cache. I don't think this is important enough to calc for every view)
|
||||
if (Cfg::get('PROFILER_ENABLE') && !($this->subject->getField('cuFlags') & CUSTOM_EXCLUDE_FOR_LISTVIEW))
|
||||
{
|
||||
$x = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ?_profiler_completion_reputation WHERE `standing` >= ?d AND `factionId` = ?d', 42000, $this->typeId);
|
||||
$x = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ?_profiler_completion_reputation WHERE `exalted` = 1 AND `factionId` = ?d', $this->typeId);
|
||||
$y = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ?_profiler_profiles WHERE `custom` = 0 AND `stub` = 0');
|
||||
$infobox[] = Lang::profiler('attainedBy', [round(($x ?: 0) * 100 / ($y ?: 1))]);
|
||||
|
||||
|
||||
@@ -1749,8 +1749,10 @@ CREATE TABLE `aowow_profiler_completion_reputation` (
|
||||
`id` int(10) unsigned NOT NULL,
|
||||
`factionId` smallint(5) unsigned NOT NULL,
|
||||
`standing` mediumint(9) DEFAULT NULL,
|
||||
`exalted` tinyint(1) GENERATED ALWAYS AS (`standing` >= 42000) STORED,
|
||||
KEY `id` (`id`),
|
||||
KEY `typeId` (`factionId`),
|
||||
KEY `idx_exalted` (`exalted`),
|
||||
CONSTRAINT `FK_pr_completion_reputation` FOREIGN KEY (`id`) REFERENCES `aowow_profiler_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
@@ -71,7 +71,7 @@ UNLOCK TABLES;
|
||||
|
||||
LOCK TABLES `aowow_dbversion` WRITE;
|
||||
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
|
||||
INSERT INTO `aowow_dbversion` VALUES (1762543653,0,NULL,NULL);
|
||||
INSERT INTO `aowow_dbversion` VALUES (1762700148,0,NULL,NULL);
|
||||
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
4
setup/sql/updates/1762700147_01.sql
Normal file
4
setup/sql/updates/1762700147_01.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE aowow_profiler_completion_reputation
|
||||
ADD COLUMN `exalted` tinyint(1) GENERATED ALWAYS AS (`standing` >= 42000) STORED AFTER `standing`,
|
||||
ADD KEY idx_exalted (`exalted`)
|
||||
;
|
||||
Reference in New Issue
Block a user