don't call vacuum here, is not working (but why was it there in the first place???)
collect the calculated information only once and re-use it as parameter (instead of using a WITH clause)