mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 08:41:39 +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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
<table name="counter_log">
|
||||
<column name="site_srl" type="bigint" notnull="notnull" default="0" index="idx_site_counter_log" />
|
||||
<column name="ipaddress" type="varchar" size="60" notnull="notnull" index="idx_site_counter_log" />
|
||||
<column name="regdate" type="date" notnull="notnull" index="idx_counter_log" />
|
||||
<column name="id" type="bigint" notnull="notnull" primary_key="primary_key" auto_increment="auto_increment" />
|
||||
<column name="site_srl" type="bigint" notnull="notnull" default="0" />
|
||||
<column name="regdate" type="date" notnull="notnull" />
|
||||
<column name="ipaddress" type="varchar" size="60" notnull="notnull" />
|
||||
<column name="user_agent" type="varchar" size="250" />
|
||||
<index name="idx_regdate_ipaddress" columns="regdate(8),ipaddress" />
|
||||
</table>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue