Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Serge Rielau
Actually there are lots of things that can be done with this sort of theorem proving. And NULL is a plenty good answer for a filter, just not for a check constraint. Amongst them INSERT through UNION ALL for symmetric views which can be handy for FDW partitioned tables. One such implementation

Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Pantelis Theodosiou
On Mon, Dec 5, 2016 at 7:02 PM, Corey Huinker wrote: > >> Would it be worth replacing the condition with the equivalent? >> I mean would that help optimizing better some queries when it knows that >> a is (not) nullable or when "a" is more complicated expression? >> >> a

Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Corey Huinker
> > > Would it be worth replacing the condition with the equivalent? > I mean would that help optimizing better some queries when it knows that a > is (not) nullable or when "a" is more complicated expression? > > a <> a: (a IS NULL) AND NULL > a = a : (a IS NOT NULL) OR NULL > I

Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Pantelis Theodosiou
On Mon, Dec 5, 2016 at 3:24 PM, Tom Lane wrote: > Pavel Stehule writes: > > 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

Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Pavel Stehule
2016-12-05 16:41 GMT+01:00 Stephen Frost : > Pavel, > > * Pavel Stehule (pavel.steh...@gmail.com) wrote: > > 2016-12-05 16:23 GMT+01:00 Stephen Frost : > > > * Pavel Stehule (pavel.steh...@gmail.com) wrote: > > > > I found some crazy queries in one customer

Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Stephen Frost
Pavel, * Pavel Stehule (pavel.steh...@gmail.com) wrote: > 2016-12-05 16:23 GMT+01:00 Stephen Frost : > > * Pavel Stehule (pavel.steh...@gmail.com) wrote: > > > I found some crazy queries in one customer application. These queries are > > > stupid, but it was surprise for me so

Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Pavel Stehule
2016-12-05 16:23 GMT+01:00 Stephen Frost : > Pavel, > > * Pavel Stehule (pavel.steh...@gmail.com) wrote: > > 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 > > > >

Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Pavel Stehule
2016-12-05 16:24 GMT+01:00 Tom Lane : > Pavel Stehule writes: > > 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

Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Stephen Frost
Pavel, * Pavel Stehule (pavel.steh...@gmail.com) wrote: > 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,10); >

Re: [HACKERS] missing optimization - column <> column

2016-12-05 Thread Tom Lane
Pavel Stehule writes: > 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,10); > analyze foo;

[HACKERS] missing optimization - column <> column

2016-12-05 Thread Pavel Stehule
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,10); analyze foo; explain select * from foo where a <> a; It does full