Skip to content

Generated normalized_address expression recalculated on every row update #35

@haydenk

Description

@haydenk

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:

  1. Drop the generated column and compute normalization in the application layer only when needed for search.
  2. 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).
  3. Use a regular column updated only by the existing search_vector trigger when address changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance improvement

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions