Why not do distinct before SetOp - Mailing list pgsql-general

From ma lz
Subject Why not do distinct before SetOp
Date
Msg-id TYCPR01MB63514B9C70EF2A80F0D43394F2512@TYCPR01MB6351.jpnprd01.prod.outlook.com
Whole thread Raw
Responses Re: Why not do distinct before SetOp
List pgsql-general
some sql like ' select a from t1 intersect select a from t1 '

if t1 has large number rows but has few distinct rows

select distinct a from t1 intersect select distinct a from t1;    ― this is faster than origin sql

can postgres do this optimize during plan-queries?

pgsql-general by date:

Previous
From: Vijaykumar Jain
Date:
Subject: Re: Random memory related errors on live postgres 14.13 instance on Ubuntu 22.04 LTS
Next
From: David Rowley
Date:
Subject: Re: Why not do distinct before SetOp