]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5437] Replaced index by iaid_subnet_id_duid with duid_iaid_subnet_id.
authorMarcin Siodelski <marcin@isc.org>
Tue, 27 Feb 2018 20:06:28 +0000 (21:06 +0100)
committerMarcin Siodelski <marcin@isc.org>
Tue, 27 Feb 2018 20:06:28 +0000 (21:06 +0100)
src/share/database/scripts/mysql/dhcpdb_create.mysql
src/share/database/scripts/mysql/upgrade_5.1_to_6.0.sh.in
src/share/database/scripts/pgsql/dhcpdb_create.pgsql
src/share/database/scripts/pgsql/upgrade_3.2_to_4.0.sh.in

index b1cdd1d05883f60f2ee61d97db4bda20691afa3c..4732ae6524446bf9d2d6b67ed40fdabf21faa439 100644 (file)
@@ -516,6 +516,13 @@ CREATE INDEX lease4_by_subnet_id ON lease4 (subnet_id);
 # Create for searching leases by subnet identifier and lease type.
 CREATE INDEX lease6_by_subnet_id_lease_type ON lease6 (subnet_id, lease_type);
 
+# The index by iaid_subnet_id_duid is not the best choice because there are
+# cases when we don't specify subnet identifier while searching leases. The
+# index will be universal if the subnet_id is the right most column in the
+# index.
+DROP INDEX lease6_by_iaid_subnet_id_duid on lease6;
+CREATE INDEX lease6_by_duid_iaid_subnet_id ON lease6 (duid, iaid, subnet_id);
+
 # Update the schema version number
 UPDATE schema_version
 SET version = '6', minor = '0';
index c4e78091289abf4d3bffdbfb66c9e4f163fa5857..5d48d5dc6a02837bbd27962b6ca76ed873a361a9 100644 (file)
@@ -30,6 +30,13 @@ CREATE INDEX lease4_by_subnet_id ON lease4 (subnet_id);
 # Create for searching leases by subnet identifier and lease type.
 CREATE INDEX lease6_by_subnet_id_lease_type ON lease6 (subnet_id, lease_type);
 
+# The index by iaid_subnet_id_duid is not the best choice because there are
+# cases when we don't specify subnet identifier while searching leases. The
+# index will be universal if the subnet_id is the right most column in the
+# index.
+DROP INDEX lease6_by_iaid_subnet_id_duid on lease6;
+CREATE INDEX lease6_by_duid_iaid_subnet_id ON lease6 (duid, iaid, subnet_id);
+
 # Update the schema version number
 UPDATE schema_version
 SET version = '6', minor = '0';
index 90d1aed7da55cc0eb40bc9b00fe514009d4d0213..d5041520feef2ee56bb8944d1502b808e14506c0 100644 (file)
@@ -543,6 +543,13 @@ CREATE INDEX lease4_by_subnet_id ON lease4 (subnet_id);
 -- Create for searching leases by subnet identifier and lease type.
 CREATE INDEX lease6_by_subnet_id_lease_type ON lease6 (subnet_id, lease_type);
 
+-- The index by iaid_subnet_id_duid is not the best choice because there are
+-- cases when we don't specify subnet identifier while searching leases. The
+-- index will be universal if the subnet_id is the right most column in the
+-- index.
+DROP INDEX lease6_by_iaid_subnet_id_duid;
+CREATE INDEX lease6_by_duid_iaid_subnet_id ON lease6 (duid, iaid, subnet_id);
+
 -- Set 4.0 schema version.
 UPDATE schema_version
     SET version = '4', minor = '0';
index c20e114f2a344cef067ff9a27b80439c4557d793..c1a249c7c68bec94fa399d82c77a13eca0a4fb2d 100644 (file)
@@ -32,6 +32,13 @@ CREATE INDEX lease4_by_subnet_id ON lease4 (subnet_id);
 -- Create for searching leases by subnet identifier and lease type.
 CREATE INDEX lease6_by_subnet_id_lease_type ON lease6 (subnet_id, lease_type);
 
+-- The index by iaid_subnet_id_duid is not the best choice because there are
+-- cases when we don't specify subnet identifier while searching leases. The
+-- index will be universal if the subnet_id is the right most column in the
+-- index.
+DROP INDEX lease6_by_iaid_subnet_id_duid;
+CREATE INDEX lease6_by_duid_iaid_subnet_id ON lease6 (duid, iaid, subnet_id);
+
 -- Set 4.0 schema version.
 UPDATE schema_version
     SET version = '4', minor = '0';