From 54bbed5fcbe237c5a49b515ae4c55148723406ce Mon Sep 17 00:00:00 2001 From: Thomas Markwalder Date: Mon, 11 Feb 2013 15:39:59 -0500 Subject: [PATCH] [2699] Added composite search indexes to lease4 and lease6 tables to boost performance. Note: This change fulfills both 2699 (lease4) and 2703 (lease6). --- src/lib/dhcpsrv/dhcpdb_create.mysql | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/dhcpsrv/dhcpdb_create.mysql b/src/lib/dhcpsrv/dhcpdb_create.mysql index 695091dc87..b7b7635d36 100644 --- a/src/lib/dhcpsrv/dhcpdb_create.mysql +++ b/src/lib/dhcpsrv/dhcpdb_create.mysql @@ -39,6 +39,14 @@ CREATE TABLE lease4 ( subnet_id INT UNSIGNED # Subnet identification ) ENGINE = INNODB; + +# Create search indexes for lease4 table +# index by hwaddr and subnet_id +CREATE INDEX lease4_by_hwaddr_subnet_id ON lease4 (hwaddr, subnet_id); + +# index by client_id and subnet_id +CREATE INDEX lease4_by_client_id_subnet_id ON lease4 (client_id, subnet_id); + # Holds the IPv6 leases. # N.B. The use of a VARCHAR for the address is temporary for development: # it will eventually be replaced by BINARY(16). @@ -55,6 +63,10 @@ CREATE TABLE lease6 ( prefix_len TINYINT UNSIGNED # For IA_PD only ) ENGINE = INNODB; +# Create search indexes for lease4 table +# index by iaid, subnet_id, and duid +CREATE INDEX lease6_by_iaid_subnet_id_duid ON lease6 (iaid, subnet_id, duid); + # ... and a definition of lease6 types. This table is a convenience for # users of the database - if they want to view the lease table and use the # type names, they can join this table with the lease6 table