# by the expiration time. One of the applications is to retrieve all
# expired leases. However, these indexes can be also used to retrieve
# leases in a given state regardless of the expiration time.
-CREATE INDEX lease4_by_state_expire ON lease4 (state, expire);
-CREATE INDEX lease6_by_state_expire ON lease6 (state, expire);
+CREATE INDEX lease4_by_state_expire ON lease4 (state ASC, expire ASC);
+CREATE INDEX lease6_by_state_expire ON lease6 (state ASC, expire ASC);
# Create table holding mapping of the lease states to their names.
# This is not used in queries from the DHCP server but rather in
# by the expiration time. One of the applications is to retrieve all
# expired leases. However, these indexes can be also used to retrieve
# leases in a given state regardless of the expiration time.
-CREATE INDEX lease4_by_state_expire ON lease4 (state, expire);
-CREATE INDEX lease6_by_state_expire ON lease6 (state, expire);
+CREATE INDEX lease4_by_state_expire ON lease4 (state ASC, expire ASC);
+CREATE INDEX lease6_by_state_expire ON lease6 (state ASC, expire ASC);
# Create table holding mapping of the lease states to their names.
# This is not used in queries from the DHCP server but rather in
"state "
"FROM lease4 "
"WHERE state != ? AND expire < ? "
- "ORDER BY expire "
+ "ORDER BY expire ASC "
"LIMIT ?"},
{MySqlLeaseMgr::GET_LEASE6_ADDR,
"SELECT address, duid, valid_lifetime, "
"state "
"FROM lease6 "
"WHERE state != ? AND expire < ? "
- "ORDER BY expire "
+ "ORDER BY expire ASC "
"LIMIT ?"},
{MySqlLeaseMgr::GET_VERSION,
"SELECT version, minor FROM schema_version"},
"ALTER TABLE lease6 "
"ADD COLUMN state INT UNSIGNED DEFAULT 0",
- "CREATE INDEX lease4_by_state_expire ON lease4 (state, expire)",
- "CREATE INDEX lease6_by_state_expire ON lease6 (state, expire)",
+ "CREATE INDEX lease4_by_state_expire ON lease4 (state ASC, expire ASC)",
+ "CREATE INDEX lease6_by_state_expire ON lease6 (state ASC, expire ASC)",
// Production schema includes the lease_state table and
// lease_hwaddr_source tables which map to the values in lease4