Subject | Re: How to get best plan for typical Order–Customer? |
---|---|
Author | kokok_kokok |
Post date | 2008-11-15T18:25:25Z |
I have tried the Orders.CustomerId+0=Customers.CustomerId proposal but
regrettably I get the same natural plan: PLAN JOIN (CUSTOMERS NATURAL,
ORDERS INDEX (IDX_ORDER_DATE)). in fact, it is worst because now I
never get the optimal plan, including the initial statement:
select sum(Orders.units) from Orders inner join Customers on
Orders.CustomerId=Customers.CustomerId
where Orders.OrderDate between `2007/1/1' and `2007/12/31'
returns a optimal plan, but
select sum(Orders.units) from Orders inner join Customers on
Orders.CustomerId+0=Customers.CustomerId
where Orders.OrderDate between `2007/1/1' and `2007/12/31'
regrettably I get the same natural plan: PLAN JOIN (CUSTOMERS NATURAL,
ORDERS INDEX (IDX_ORDER_DATE)). in fact, it is worst because now I
never get the optimal plan, including the initial statement:
select sum(Orders.units) from Orders inner join Customers on
Orders.CustomerId=Customers.CustomerId
where Orders.OrderDate between `2007/1/1' and `2007/12/31'
returns a optimal plan, but
select sum(Orders.units) from Orders inner join Customers on
Orders.CustomerId+0=Customers.CustomerId
where Orders.OrderDate between `2007/1/1' and `2007/12/31'