ePrivacy and GPDR Cookie Consent by Cookie Consent Skip to main content

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, and the attribute will stop calculating
Deleting the attribute definition in public.attributes table
  • Run the following script in SQL, remember to change the id of the attribute accordingly
  • This will remove the attribute completely in CDP. Plumbing will handle the deletion of attribute from public.customer_attributes table
from public.attributes
where id = 'XXX'
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.

  1. Stop CPS
  2. Make sure CPS processes is not running using pg_stat_activity and pg_cancel_backend
select pg_terminate_backend(pid)
from pg_stat_activity
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.