Re: [HACKERS] Optimizer boolean syntax

2002-11-23 Thread Daniele Orlandi
Tom Lane wrote: Only two of them are logically equivalent. Consider NULL. Ohhh IS NOT TRUE or IS NOT FALSE also match NULL, I never knew this :) Even for the first two, assuming equivalence requires hard-wiring an assumption about the behavior of the bool = bool operator; which is a

Re: [HACKERS] Optimizer boolean syntax

2002-11-22 Thread scott.marlowe
On Thu, 21 Nov 2002, Stephan Szabo wrote: On Thu, 21 Nov 2002, Christopher Kings-Lynne wrote: col isn't of the general form indexkey op constant or constant op indexkey which I presume it's looking for given the comments in indxpath.c. I'm not sure what the best way to make

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Robert Treat
Using the famous WAG tech, in your first query the optimizer has to evaluate monitored for each record to determine its value. Robert Treat On Thu, 2002-11-21 at 13:39, Daniele Orlandi wrote: Are those two syntaxes eqivalent ? select * from users where monitored; select * from users where

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Stephan Szabo
On Thu, 21 Nov 2002, Daniele Orlandi wrote: Are those two syntaxes eqivalent ? select * from users where monitored; select * from users where monitored=true; If the answer is yes, the optimimer probably doesn't agree with you :) That depends on the definition of equivalent. They

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Christopher Kings-Lynne
Are those two syntaxes eqivalent ? select * from users where monitored; select * from users where monitored=true; If the answer is yes, the optimimer probably doesn't agree with you :) That depends on the definition of equivalent. They presumably give the same answer (I'm assuming

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Stephan Szabo
On Thu, 21 Nov 2002, Christopher Kings-Lynne wrote: Are those two syntaxes eqivalent ? select * from users where monitored; select * from users where monitored=true; If the answer is yes, the optimimer probably doesn't agree with you :) That depends on the definition of

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Christopher Kings-Lynne
I think his point is that they _should_ be equivalent. Surely there's something in the optimiser that discards '=true' stuff, like 'a=a' should be discarded? I figure that's what he meant, but it isn't what was said. ;) col isn't of the general form indexkey op constant or constant op

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread scott.marlowe
On Thu, 21 Nov 2002, Christopher Kings-Lynne wrote: I think his point is that they _should_ be equivalent. Surely there's something in the optimiser that discards '=true' stuff, like 'a=a' should be discarded? I figure that's what he meant, but it isn't what was said. ;) col

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread scott.marlowe
On Thu, 21 Nov 2002, Christopher Kings-Lynne wrote: I think his point is that they _should_ be equivalent. Surely there's something in the optimiser that discards '=true' stuff, like 'a=a' should be discarded? I figure that's what he meant, but it isn't what was said. ;) col

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Christopher Kings-Lynne
Not that I see the point of indexing booleans, but hey :) If one of the values is much more infrequent than the other, you can probably get a substantial win using a partial index, can't you? Yes, I thought of the partial index after I wrote that email :) Chris

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Christopher Kings-Lynne
col isn't of the general form indexkey op constant or constant op indexkey which I presume it's looking for given the comments in indxpath.c. I'm not sure what the best way to make it work would be given that presumably we'd want to make col IS TRUE/FALSE use an index at the same

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Stephan Szabo
On Thu, 21 Nov 2002, Christopher Kings-Lynne wrote: col isn't of the general form indexkey op constant or constant op indexkey which I presume it's looking for given the comments in indxpath.c. I'm not sure what the best way to make it work would be given that presumably we'd

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Daniele Orlandi
Stephan Szabo wrote: On Thu, 21 Nov 2002, Daniele Orlandi wrote: Are those two syntaxes eqivalent ? select * from users where monitored; select * from users where monitored=true; If the answer is yes, the optimimer probably doesn't agree with you :) That depends on the definition of

Re: [HACKERS] Optimizer boolean syntax

2002-11-21 Thread Tom Lane
Daniele Orlandi [EMAIL PROTECTED] writes: The problem is the opposite... so, effectively, seems that the optimizer considers monitored and monitored=true as two different expressions... Check. The viceversa is analog and we also can see that the syntax monitored is true is considered