Add prefix index on value column of document_extra_vars table

This commit is contained in:
Kijin Sung 2025-10-24 09:04:18 +09:00
parent f7301b0a22
commit b119578209
2 changed files with 6 additions and 0 deletions

View file

@ -113,6 +113,7 @@ class Document extends ModuleObject
// 2025.10.23 Add sort to document_extra_keys table, and sort_value to document_extra_vars table
if(!$oDB->isColumnExists('document_extra_keys', 'var_sort')) return true;
if(!$oDB->isColumnExists('document_extra_vars', 'sort_value') || !$oDB->isIndexExists('document_extra_vars', 'idx_sort_value')) return true;
if(!$oDB->isIndexExists('document_extra_vars', 'idx_prefix_value')) return true;
// Delete unnecessary index
if($oDB->isIndexExists('document_extra_vars', 'idx_document_list_order')) return true;
@ -263,6 +264,10 @@ class Document extends ModuleObject
$oDB->commit();
$oDB->addIndex('document_extra_vars', 'idx_sort_value', array('module_srl', 'sort_value'));
}
if(!$oDB->isIndexExists('document_extra_vars', 'idx_prefix_value'))
{
$oDB->addIndex('document_extra_vars', 'idx_prefix_value', array('module_srl', 'value(10)'));
}
// Delete unnecessary index
if($oDB->isIndexExists('document_extra_vars', 'idx_document_list_order'))

View file

@ -6,5 +6,6 @@
<column name="value" type="bigtext" />
<column name="sort_value" type="bigint" />
<column name="eid" type="varchar" size="40" />
<index name="idx_prefix_value" columns="module_srl,value(10)" />
<index name="idx_sort_value" columns="module_srl,sort_value" />
</table>