Optimizer question

2007-12-07 Thread Thomas Nielsen
I have a optimizer question I was hoping for someone well versed could provide some input to: As part of my work on DERBY-2998, the implementation of the ROW_NUMBER() window function, I'm having trouble with the optimizer and its (lack of) pushing predicates down the query tree

Re: Optimizer question

2007-12-07 Thread Thomas Nielsen
Army, Thanks for taking the time to have a look at this. To add to the info I see the same kind of queryplan in the similar query where the aliased expression is exchanged with 'a*b': SELECT * FROM (SELECT a*b AS R, T.* FROM T) AS TR WHERE R 3; So I'm starting to wonder if this is a general

Re: Optimizer question

2007-12-07 Thread Daniel John Debrunner
Bryan Pendleton wrote: As part of my work on DERBY-2998, the implementation of the ROW_NUMBER() window function, I'm having trouble with the optimizer and its (lack of) pushing predicates down the query tree. Hi Thomas Army, this is a very interesting discussion and I'm learning a lot by

Re: Optimizer question

2007-12-07 Thread Bryan Pendleton
As part of my work on DERBY-2998, the implementation of the ROW_NUMBER() window function, I'm having trouble with the optimizer and its (lack of) pushing predicates down the query tree. Hi Thomas Army, this is a very interesting discussion and I'm learning a lot by following it, so please

Re: Optimizer question

2007-12-07 Thread Thomas Nielsen
Army wrote: Oops, sorry about that. I was just reading your email, I didn't read the comments on DERBY-2998. Apologies for the noise... I wasn't expecting you to either - apologies if I sounded like that. And it's by no means noise to me - it was acutally truly rewarding to see that my

Re: Optimizer question

2007-12-07 Thread Army
Thomas Nielsen wrote: If you look at my comments in DERBY-2998, I acutally got this far a while ago. Oops, sorry about that. I was just reading your email, I didn't read the comments on DERBY-2998. Apologies for the noise... One of the results of adding the extra if

Re: Optimizer question

2007-12-07 Thread Thomas Nielsen
Bryan Pendleton wrote: [snip] With the new restriction approach that you are proposing for DERBY-2998, am I correct that you are suggesting we might invent a new ResultSet node implementation, which computes the ROW_NUMBER() value for its rows? Almost. In my patch I'm suggesting to

Re: Optimizer question

2007-12-07 Thread Army
Thomas Nielsen wrote: As part of my work on DERBY-2998, the implementation of the ROW_NUMBER() window function, I'm having trouble with the optimizer and its (lack of) pushing predicates down the query tree. [ snip ] To add to the info I see the same kind of queryplan in the similar query

Optimizer: question about predicate pushdown and handling of intermediate costs

2006-11-22 Thread Bryan Pendleton
Hi Optimizer Enthusiasts! I've been thinking about predicate pushdown and have a question. The question specifically involves this section of code in OptimizerImpl: double newCost = currentCost.getEstimatedCost(); double pullCost = 0.0;

Re: Optimizer: question about predicate pushdown and handling of intermediate costs

2006-11-22 Thread Army
Bryan Pendleton wrote: I have two questions about this code, both related to the edge-cases of floating point behavior: I think both of your questions fall into the category of DERBY-1260, which was filed for investigation of how infinite cost estimates affect Derby costing calculations. I

Re: Optimizer: question about predicate pushdown and handling of intermediate costs

2006-11-22 Thread Bryan Pendleton
I think both of your questions fall into the category of DERBY-1260, I agree. I will attach these thoughts to that issue. Thank you very much for the thoughtful reply! There is much to learn about the optimizer. bryan