How do you add a constraint to a large table under load?

You have a PostgreSQL orders table with hundreds of millions of rows. The service constantly reads from and writes to it. You need to add a foreign key referencing customers and a CHECK (total >= 0) constraint. What happens if you use a regular ALTER TABLE … ADD CONSTRAINT? How would you perform the migration without prolonged downtime?

ExplainDDL, keys, and normalizationSeniorBackendData Engineer