浏览代码

added index to make usrloc expires fast

Jiri Kuthan 18 年之前
父节点
当前提交
6909b18b6a
共有 4 个文件被更改,包括 10 次插入3 次删除
  1. 5 1
      db/schema/location.xml
  2. 2 1
      scripts/mysql/my_create.sql
  3. 2 1
      scripts/oracle/or_create.sql
  4. 1 0
      scripts/postgres/pg_create.sql

+ 5 - 1
db/schema/location.xml

@@ -59,7 +59,7 @@
 	</description>
 	</description>
     </column>
     </column>
 
 
-    <column>
+	<column id="location.expires">
 	<name>expires</name>
 	<name>expires</name>
 	<type>datetime</type>
 	<type>datetime</type>
 	<default>1970-01-01 00:00:00</default>
 	<default>1970-01-01 00:00:00</default>
@@ -142,4 +142,8 @@
 	<name>location_contact</name>
 	<name>location_contact</name>
 	<colref linkend="location.contact"/>
 	<colref linkend="location.contact"/>
     </index>
     </index>
+	<index>
+	<name>location_expires</name>
+	<colref linkend="location.expires"/>
+    </index>
 </table>
 </table>

+ 2 - 1
scripts/mysql/my_create.sql

@@ -171,7 +171,8 @@ CREATE TABLE location (
     user_agent VARCHAR(64),
     user_agent VARCHAR(64),
     instance VARCHAR(255),
     instance VARCHAR(255),
     UNIQUE KEY location_key (uid, contact),
     UNIQUE KEY location_key (uid, contact),
-    KEY location_contact (contact)
+    KEY location_contact (contact),
+    KEY location_expires (expires)
 );
 );
 
 
 INSERT INTO version (table_name, table_version) values ('contact_attrs','1');
 INSERT INTO version (table_name, table_version) values ('contact_attrs','1');

+ 2 - 1
scripts/oracle/or_create.sql

@@ -171,7 +171,8 @@ CREATE TABLE location (
     user_agent VARCHAR(64),
     user_agent VARCHAR(64),
     instance VARCHAR(255),
     instance VARCHAR(255),
     UNIQUE KEY location_key (uuid, contact),
     UNIQUE KEY location_key (uuid, contact),
-    KEY location_contact (contact)
+    KEY location_contact (contact),
+    KEY location_expires (expires)
 );
 );
 
 
 INSERT INTO version (table_name, table_version) values ('contact_attrs','1');
 INSERT INTO version (table_name, table_version) values ('contact_attrs','1');

+ 1 - 0
scripts/postgres/pg_create.sql

@@ -180,6 +180,7 @@ CREATE TABLE location (
 );
 );
 
 
 CREATE INDEX location_contact ON location (contact);
 CREATE INDEX location_contact ON location (contact);
+CREATE INDEX location_expires ON location (expires);
 
 
 INSERT INTO version (table_name, table_version) values ('contact_attrs','1');
 INSERT INTO version (table_name, table_version) values ('contact_attrs','1');
 CREATE TABLE contact_attrs (
 CREATE TABLE contact_attrs (