Anzi cancellerei tutto e farei cosi:

SELECT COUNT(DISTINCT title)
FROM photos