Subquery Vs CTE1.1
SELECT
cat_name,
max_pet_date
FROM cat_dim
LEFT JOIN (
SELECT
cat_id,
MAX(timestamp)::DATE AS max_pet_date,
MIN(timestamp)::DATE AS min_pet_date
FROM cat_pet_fact
GROUP BY cat_id
) AS avg_pet_count_over_time
ON cat_dim.cat_id = avg_pet_count_over_time.cat_id;