Re: Query rewrite(optimization) using constraints

2021-10-08 Thread Tom Lane
Lily Liu writes: > I propose two new types of query rewrites using constraints here > 1) Remove DISTINCT > A simple example is SELECT DISTINCT(name) FROM R. If there is a unique > constraint on the name column. The DISTINCT keyword can be removed safely. > Query plans without the DISTINCT keyword

Re: Query rewrite(optimization) using constraints

2021-10-08 Thread Justin Pryzby
On Fri, Oct 08, 2021 at 10:24:33AM -0700, Lily Liu wrote: > 1) Remove DISTINCT > > A simple example is SELECT DISTINCT(name) FROM R. If there is a unique > constraint on the name column. The DISTINCT keyword can be removed safely. > Query plans without the DISTINCT keyword might be much cheaper si