mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 07:25:18 +00:00
[#2452] Improve postgresl indexes on hosts table
src/share/database/scripts/pgsql/dhcpdb_create.pgsql src/share/database/scripts/pgsql/upgrade_012_to_013.sh.in Added host index for dhcp identifier + type only - v4 and v6 Modified existing host index to include subnet-id = 0 - v4 and v6
This commit is contained in:
@@ -5604,6 +5604,24 @@ BEGIN
|
|||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
-- Improve hosts indexes for better performance of global reservations
|
||||||
|
-- Create new index that uses only dhcp4_identifier.
|
||||||
|
CREATE INDEX key_dhcp4_identifier on hosts (dhcp_identifier, dhcp_identifier_type);
|
||||||
|
-- Create new index that uses only dhcp4_identifier.
|
||||||
|
CREATE INDEX key_dhcp6_identifier on hosts (dhcp_identifier, dhcp_identifier_type);
|
||||||
|
|
||||||
|
-- Modify existing indexes to include subnet_id values of 0, so index is also used
|
||||||
|
-- for global reservations.
|
||||||
|
DROP INDEX key_dhcp4_identifier_subnet_id;
|
||||||
|
CREATE UNIQUE INDEX key_dhcp4_identifier_subnet_id ON hosts
|
||||||
|
(dhcp_identifier ASC, dhcp_identifier_type ASC, dhcp4_subnet_id ASC)
|
||||||
|
WHERE (dhcp4_subnet_id IS NOT NULL);
|
||||||
|
|
||||||
|
DROP INDEX key_dhcp6_identifier_subnet_id;
|
||||||
|
CREATE UNIQUE INDEX key_dhcp6_identifier_subnet_id ON hosts
|
||||||
|
(dhcp_identifier ASC, dhcp_identifier_type ASC, dhcp6_subnet_id ASC)
|
||||||
|
WHERE (dhcp6_subnet_id IS NOT NULL);
|
||||||
|
|
||||||
-- Update the schema version number.
|
-- Update the schema version number.
|
||||||
UPDATE schema_version
|
UPDATE schema_version
|
||||||
SET version = '13', minor = '0';
|
SET version = '13', minor = '0';
|
||||||
|
@@ -653,6 +653,24 @@ BEGIN
|
|||||||
END;
|
END;
|
||||||
\$\$ LANGUAGE plpgsql;
|
\$\$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
-- Improve hosts indexes for better performance of global reservations
|
||||||
|
-- Create new index that uses only dhcp4_identifier.
|
||||||
|
CREATE INDEX key_dhcp4_identifier on hosts (dhcp_identifier, dhcp_identifier_type);
|
||||||
|
-- Create new index that uses only dhcp4_identifier.
|
||||||
|
CREATE INDEX key_dhcp6_identifier on hosts (dhcp_identifier, dhcp_identifier_type);
|
||||||
|
|
||||||
|
-- Modify existing indexes to include subnet_id values of 0, so index is also used
|
||||||
|
-- for global reservations.
|
||||||
|
DROP INDEX IF EXISTS key_dhcp4_identifier_subnet_id;
|
||||||
|
CREATE UNIQUE INDEX key_dhcp4_identifier_subnet_id ON hosts
|
||||||
|
(dhcp_identifier ASC, dhcp_identifier_type ASC, dhcp4_subnet_id ASC)
|
||||||
|
WHERE (dhcp4_subnet_id IS NOT NULL);
|
||||||
|
|
||||||
|
DROP INDEX IF EXISTS key_dhcp6_identifier_subnet_id;
|
||||||
|
CREATE UNIQUE INDEX key_dhcp6_identifier_subnet_id ON hosts
|
||||||
|
(dhcp_identifier ASC, dhcp_identifier_type ASC, dhcp6_subnet_id ASC)
|
||||||
|
WHERE (dhcp6_subnet_id IS NOT NULL);
|
||||||
|
|
||||||
-- Update the schema version number.
|
-- Update the schema version number.
|
||||||
UPDATE schema_version
|
UPDATE schema_version
|
||||||
SET version = '13', minor = '0';
|
SET version = '13', minor = '0';
|
||||||
|
Reference in New Issue
Block a user