Data masking in ParadeDB hides or obfuscates sensitive column values at query time, letting developers share production-like datasets without exposing real information.
Masking prevents accidental exposure of PII while allowing realistic analytics and testing. ParadeDB applies rules at query time, so raw values remain untouched on disk.
Mask any field that identifies a person—email, phone, credit-card digits, addresses, and session tokens—especially when granting readonly access to staging or analysts.
You define a masking policy that maps columns to masking expressions.ParadeDB rewrites SELECTs for roles that are not exempt, replacing the original column with the masked expression.
No copies.Rules live in catalog tables and run transparently, minimising storage and sync headaches.
1 ) Draft a policy using CREATE MASKING POLICY.
2 ) Attach it to the target table with ALTER TABLE … ENABLE MASKING.
3 ) Grant the sensitive role a BYPASS privilege if full data is required.
The query in the next section masks everything right of the first character and domain name, e.g.“a*****@****.com”.
SET ROLE to an analyst account and run a simple SELECT. You should see obfuscated values. RESET ROLE and repeat as an admin to confirm unmasked data appears.
Keep masking functions deterministic for joins; store all policies in migration scripts; review masking coverage in every release; avoid masking primary-key columns to preserve referential integrity.
Using non-stable functions causes planner cache issues—mark masking functions STABLE.Forgetting to enable policies leaves data wide open—run ALTER TABLE … ENABLE MASKING in the same migration.
Only service accounts that absolutely must write or debug PII should receive BYPASS privileges. Prefer granting masked data to most humans.
Masking adds negligible latency for simple string operations. Heavy cryptographic hashing may slow large scans; create functional indexes on masked expressions if needed.
.
Yes. List each column in the ON clause and map them in the USING expression array or create separate policies for clarity.
No. Masking only rewrites SELECT and RETURNING clauses, leaving DML input untouched.
ALTER TABLE table DISABLE MASKING POLICY policy_name or DROP MASKING POLICY policy_name; always audit who gains unmasked access after removal.