Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email email@example.com
From: mos (mos99fastmail.fm)
Date: Thu Mar 12 2009 - 11:56:44 CDT
I have a view which is a 3 table join on a compound index.
I have two indexes: Index1: Product_Code, Store_Id, Date_Sold and
If I execute a select like:
select * from MyView where product_code="123";
it returns the results in 3 seconds from 15 million rows because it uses
But if I execute
select * from MyView where Date_Sold="2009-03-10";
for some reason it is still trying to use Index1 and it takes forever to
return the results because it is doing a full table scan to join the 3 tables.
Is there a way to force the view to use Index2?
select * from MyView use index(Index2) where Date_Sold="2009-03-10";
throws an error.
I think the only way around it is to create another view and put the "Use
Index(Index2)" into the view itself and then call the appropriate view
depending on the Where clause of the Select statement.
Does this make sense? Or is there a better way?
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql