From: | Kim Rose Carlsen <krc(at)hiper(dot)dk> |
---|---|
To: | John R Pierce <pierce(at)hogranch(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to hint 2 coulms IS NOT DISTINCT FROM each other |
Date: | 2016-10-28 18:53:49 |
Message-ID: | AM4PR0501MB26108E40FC2BA5B398558799C7AD0@AM4PR0501MB2610.eurprd05.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>> JOIN a AS table_b
>> ON table_a.id = table_b.id
>> AND table_a.key = table_b.key
> Anyways, to use an index for that join, you'd need a composite index on id *AND* key, not two separate indexes.
Its not as much as for using the index, but to be able to push the where clause inside both JOINED tables.
The = operator already does this. It gives the planner the option to join the table in using either id = id or key = key. It can deduce that if I have a WHERE condition with table_a.key = 'Something', then table_b.key must also be 'Something'. It can then decide to filter table_b on key. When using IS NOT DISTINCT FROM, the planner is not considering the same options. Now its like it doesn't know table_a.key is same the same as table_b.key.
I would somehow expect the IS NOT DISTINCT FROM operator to do the same. As it establish the same rules.. If a = 'test' and a IS NOT DISTINCT FROM b then b = 'test' also
-
Kim Carlsen
From | Date | Subject | |
---|---|---|---|
Next Message | Kim Rose Carlsen | 2016-10-28 19:54:16 | Re: How to hint 2 coulms IS NOT DISTINCT FROM each other |
Previous Message | Melvin Davidson | 2016-10-28 18:53:22 | Re: Remove Standby (SLAVE) from Primary (MASTER) - Postgres9.1 |