Michael Lewis <mlewis 'at' entrata.com> writes:
> UPDATE multicards
> SET defacements = COALESCE( count, 0 )
> FROM ( SELECT multicard_uid, COUNT(*) AS count FROM tickets GROUP BY multicard_uid ) AS sub
> WHERE uid = multicard_uid OR multicard_uid is null;
>
> I expect this should work. Not sure of performance of course.
This looked great but as it seems you suspected, it's very slow :/
I interrupted it after 5 minutes run on my dev computer.
--
Guillaume Cottenceau