How to delete attributes correctly
Sometimes, an attribute is obsolete, wrongly implemented, needs to be changed etc. While it is fine to simply hide the attribute and implement a new one, sometimes there is a need to completely delete an attribute to save space on the CDP data storage in PostgreSQL and OpenSearch, especially on high data volume scenarios with huge number of customer entities and attribute values.
The following are several ways an attribute can be "deleted":
Hiding the attribute in business explorer
- It will not show up on front-end
Deleting the attribute definition in cdp_attr.attributes table
- It will stop calculating the attribute, but the existing attribute values would still exist in PostgreSQL DB and OpenSearch. This is due to the batch processing of attributes.
Deleting the attribute completely
It is not possible to delete an attribute completely right now from business explorer itself, it has to be done manually.
- Stop CPS
- Make sure CPS processes is not running using pg_stat_activity and pg_cancel_backend
where application_name ilike '%cps%';
3. Delete row from cdp_attr.attributes and public.attributes
4. Delete column of the attribute from pivoted_customer_attributes table
5. Start CPS
6. Cache Refresh on CDP
Warning: If any segments or insights on CDP contains the deleted attribute, it will cause CDP Fatal error. It is good practice to go through all segments and insights to check if the attribute to be deleted is there.
Remember: After doing this, CDP might throw an error before cache refresh is done because the front-end will check for the deleted attribute. To avoid this, do cache refresh right after deleting an attribute
This article will be updated if and when the feature to delete attributes from business explorer itself is released in the future.