Optimize the SQL for the Content module