Re: [PERFORM] Index order ignored after `is null` in query

2014-11-14 Thread Jim Nasby
On 11/7/14, 5:14 AM, Artūras Lapinskas wrote: thanks for your time and answer. Not treating IS NULL as equality operator definitely helps me to make more sense out of previous explains. You can also try creating a partial index WHERE b IS NULL. WHERE b IS NOT NULL can also sometimes be useful

Re: [PERFORM] Index order ignored after `is null` in query

2014-11-07 Thread Artūras Lapinskas
Hi, thanks for your time and answer. Not treating IS NULL as equality operator definitely helps me to make more sense out of previous explains. -- Best Regard, Artūras Lapinskas On Thu, Nov 06, 2014 at 12:23:12PM -0500, Tom Lane wrote: =?utf-8?Q?Art=C5=ABras?= Lapinskas writes: After some

Re: [PERFORM] Index order ignored after `is null` in query

2014-11-06 Thread Tom Lane
=?utf-8?Q?Art=C5=ABras?= Lapinskas writes: > After some more investigation my wild guess would be that then nulls are > involved in query postgresql wants to double check whatever they are > really nulls in actual relation (maybe because of dead tuples). No, it's much simpler than that: IS NULL

Re: [PERFORM] Index order ignored after `is null` in query

2014-11-06 Thread Artūras Lapinskas
After some more investigation my wild guess would be that then nulls are involved in query postgresql wants to double check whatever they are really nulls in actual relation (maybe because of dead tuples). To do that it has to go and fetch pages from disk and the best way to do that is to use b

[PERFORM] Index order ignored after `is null` in query

2014-11-05 Thread Artūras Lapinskas
Hello, I am having some hard time understanding how postgresql handles null values. As much I understand null values are stored in b-tree as simple values (put as last or first depending on index). But it seems that there is something really specific about them as postgresql deliberately igno

[PERFORM] Index order ignored after `is null` in query

2014-11-05 Thread Artūras Lapinskas
Hello, I am having some hard time understanding how postgresql handles null values. As much I understand null values are stored in b-tree as simple values (put as last or first depending on index). But it seems that there is something really specific about them as postgresql deliberately igno