Yet another attempt of join optimization