missing optimization - column <> column - Mailing list pgsql-hackers

From Pavel Stehule
Subject missing optimization - column <> column
Date
Msg-id CAFj8pRD-q59wQ-0WvJXik_U-R4LYN9_Caw9yJqAT-vHX0SMwnQ@mail.gmail.com
Whole thread Raw
Responses Re: missing optimization - column <> column  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: missing optimization - column <> column  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
Hi

I found some crazy queries in one customer application. These queries are stupid, but it was surprise for me so there are not some simple optimization

create table foo(a int);
insert into foo select generate_series(1,100000);
analyze foo;
explain select * from foo where a <> a;

It does full scan of foo, although it should be replaced by false in planner time.

Same issue is a expression a = a .. can be replaced by true

Regards

Pavel

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas.
Next
From: Robert Haas
Date:
Subject: Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas.