I am not very familiar with SQL and I am having trouble understanding what this query means. I think I understand most of it but I am confused what the IS DISTINCT is doing and why it needs to be include.
UPDATE t1
SET pop_count1=sub.pop_count1
FROM
(SELECT state,
count(*) AS pop_count1
FROM t2
WHERE stime < 3600
AND stime + length > 0
GROUP BY state) sub
WHERE t1.state=sub.state
AND t1.pop_count1 IS DISTINCT FROM sub.pop_count1;