Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.0
    • None
    • SQL
    • None

    Description

      This rewrite eliminates self-joins on unique keys. Self-joins may be introduced after view expansion.

      User view:

      create view manager(mgrno, income) as 
      select e.empno, e.salary + e.bonus
      from employee e, department d
      where e.empno = d.mgrno;
      

      User query:

      select e.empname, e.empno
      from employee e, manager m
      where e.empno = m.mgrno and m.income > 100K
      

      Internal query after view expansion:

      select e.lastname, e.empno
      from employee e, employee m, department d
      where e.empno = m.empno /* PK = PK */ and e.empno = d.mgrno and 
      m.salary + m.bonus > 100K
      

      Internal query after join elimination:

      select e.lastname, e.empno
      from employee e, department d
      where e.empno = d.mgrno and 
      e.salary + e.bonus > 100K
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ioana-delaney Ioana Delaney
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: