How to Create Partitions
We recommend creating a dedicated partition in the aps_security_link
table for a reseller to increase performance when executing big data amount queries. This makes sense for resellers who deal with amounts of 10,000 or more accounts, users, resources, service plans, and so on.
To create a partition, complete the following steps:
-
Find a reseller ID by account name:
SELECT id, service_id, properties ->> 'id', properties ->> 'companyName' FROM aps_resource WHERE service_id = 'rest/pa-account' AND properties ->> 'companyName' = 'L1 Reseller'; id | service_id | ?column? | ?column? ----+-----------------+----------+-------------- 38 | rest/pa-account | 3 | L1 Reseller
-
Stop the OSS service:
kubectl scale oss-node --replicas=0
-
Create a partition for the reseller:
CREATE TABLE aps_security_link_38 (LIKE aps_security_link_default INCLUDING ALL); ALTER TABLE aps_security_link_38 OWNER TO oss; INSERT INTO aps_security_link_38 SELECT * FROM aps_security_link_default WHERE actor_id = 38; DELETE FROM aps_security_link_default WHERE actor_id = 38; ALTER TABLE aps_security_link ATTACH PARTITION aps_security_link_38 FOR VALUES IN (38);
-
Start the OSS service:
kubectl scale oss-node --replicas=1