Problem
If the esiids table uses a GENERATED ALWAYS AS column for address normalization (regex substitution), Postgres recomputes it on every UPDATE to the row regardless of whether the address field actually changed. At 3-5M rows with daily upserts touching many records, this adds measurable CPU overhead per batch.
Expected behavior
Options in order of preference:
- Drop the generated column and compute normalization in the application layer only when needed for search.
- Include address in the DO UPDATE SET WHERE clause so that rows whose address hasn't changed are skipped entirely (already partially done for other fields).
- Use a regular column updated only by the existing search_vector trigger when address changes.
Problem
If the esiids table uses a GENERATED ALWAYS AS column for address normalization (regex substitution), Postgres recomputes it on every UPDATE to the row regardless of whether the address field actually changed. At 3-5M rows with daily upserts touching many records, this adds measurable CPU overhead per batch.
Expected behavior
Options in order of preference: