MDL-60583 webservice: Add index to improve token lookup performance

Without this index every webservice call will do a full table scan
when it tries to validate a token. On a busy site with many tokens
this adds unnecessary load to the database.
This commit is contained in:
Neill Magill 2020-06-25 09:11:50 +01:00
parent c11e2517a7
commit b6c7a25d60
3 changed files with 17 additions and 2 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20200504" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20200625" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@ -2795,6 +2795,9 @@
<KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
<KEY NAME="creatorid" TYPE="foreign" FIELDS="creatorid" REFTABLE="user" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="token" UNIQUE="false" FIELDS="token" COMMENT="This index will be used anytime a token is validated."/>
</INDEXES>
</TABLE>
<TABLE NAME="blog_association" COMMENT="Associations of blog entries with courses and module instances">
<FIELDS>