Canonical forms for relational algebra expressions
There are canonical forms, but there are not unique canonical forms. Roughly, the idea is to use observe that sets form a monad and use the equational theory of Moggi's monadic metalanguage as a well-behaved IR for  optimizing queries. See Torsten Grust's PhD thesis, Comprehending Queries. 

More recently, the Ferry Project has been investigating integrating programming languages with query languages.