mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Optimize index structure of counter_log table for quick querying when a new visitor arrives
This commit is contained in:
parent
9b18c48256
commit
4a84f52edb
2 changed files with 33 additions and 3 deletions
|
|
@ -31,6 +31,20 @@ class counter extends ModuleObject
|
|||
return true;
|
||||
}
|
||||
|
||||
// Index optimization
|
||||
if (!$oDB->isIndexExists('counter_log', 'idx_regdate_ipaddress'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ($oDB->isIndexExists('counter_log', 'idx_site_counter_log'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ($oDB->isIndexExists('counter_log', 'idx_counter_log'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -46,6 +60,20 @@ class counter extends ModuleObject
|
|||
{
|
||||
$oDB->dropTable('counter_site_status');
|
||||
}
|
||||
|
||||
// Index optimization
|
||||
if (!$oDB->isIndexExists('counter_log', 'idx_regdate_ipaddress'))
|
||||
{
|
||||
$oDB->addIndex('counter_log', 'idx_regdate_ipaddress', ['regdate(8)', 'ipaddress']);
|
||||
}
|
||||
if ($oDB->isIndexExists('counter_log', 'idx_site_counter_log'))
|
||||
{
|
||||
$oDB->dropIndex('counter_log', 'idx_site_counter_log');
|
||||
}
|
||||
if ($oDB->isIndexExists('counter_log', 'idx_counter_log'))
|
||||
{
|
||||
$oDB->dropIndex('counter_log', 'idx_counter_log');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue