[openstreetmap/openstreetmap-website] Backfill enhanced changeset stats (PR #6347)
Tom Hughes
notifications at github.com
Sat Aug 23 14:49:08 UTC 2025
@tomhughes commented on this pull request.
I suspect you could do this using `in_batches_of` and `with` to construct CTEs inside the loop but it might be more hassle than it's worth.
> + # Find changeset ids to be updated
+ ids_sql = <<~SQL.squish
+ SELECT id
+ FROM changesets
+ WHERE id BETWEEN #{start_id} AND #{end_id}
+ AND (
+ COALESCE(num_created_nodes, 0) +
+ COALESCE(num_modified_nodes, 0) +
+ COALESCE(num_deleted_nodes, 0) +
+ COALESCE(num_created_ways, 0) +
+ COALESCE(num_modified_ways, 0) +
+ COALESCE(num_deleted_ways, 0) +
+ COALESCE(num_created_relations, 0) +
+ COALESCE(num_modified_relations, 0) +
+ COALESCE(num_deleted_relations, 0)
+ ) IS DISTINCT FROM num_changes
None of those columns are nullable so we don't really need the `COALESECE` calls and we can use normal comparison rather than `IS DISTINCT FROM`?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6347#pullrequestreview-3148231670
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6347/review/3148231670 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250823/7d03a461/attachment.htm>
More information about the rails-dev
mailing list