Optimize content_blocks query