The other index does have a way higher cardinality, but the query is
for 3 columns all of which are in the first index. I guess this is
just one of the situations where MySQL makes a wrong assessment.
On Jul 21, 2009, at 3:54 PM, Brent Baisley wrote:
Try doing a "SHOW INDEX FROM orders"
On Jul 21, 2009, at 3:27 PM, Johnny Withers wrote:
MySQL is unable to use your index when you use IN and/or OR on yoru
column.
Is this really true?
I'm reading "High Performance MySQL 2nd ed." these days and
specifically got the impression that using IN will allow usage of the
index. Th
Hi,
It's InnoDB on 5.0.51. The only thing I can think of that *may* be
different about this is that this index used to be on a composite key
(some_id, some_varchar) but then the VARCHAR column got dropped. Other
than that, it's just a plain index on an INT(11).
Morten
On Jun 16, 2009, a
On Mar 4, 2009, at 8:38 PM, Jocelyn Fournier wrote:
Just curious : if there's no index on the column why don't you try
to add one ? That's probably why it takes a lot of time on the
production machine.
Hehe.. I can understand why you ask, I over simplified the question
which was wrong of
Thanks for all the suggestions. The caching must be done somewhere
else. There is no index on the column and there are about 500.000 rows
in the table. A MySQL restart doesn't "flush" the cache in play, but a
full restart of my laptop does (OS X).
I may be chasing the wrong problem, but w
Hi,
I want to retrieve all records where the field "value" contains either
"foo", "bar" or "baz". Like so:
SELECT id FROM table WHERE value LIKE '%foo%' OR value LIKE '%bar%' OR
value LIKE '%baz%';
But then I stumbled upon REGEXP, and can do the same this way:
SELECT id FROM table WHERE
Hi guys,
I have 2 tables "cars" and "parts" where car has many parts. I need a
query to return some fields from the cars table as well as a field
from multiple parts records. I've come to the following approaches,
and would like to understand which is the better, and why, or if
there's a
Thanks Rob and Baron, I'd never heard of the integers table approach
before, really good stuff!
First off your porting over or dealing with formerly oracle code,
right?
Nah, I just learned SQL on Oracle back in the day. DUAL works under
MySQL also - don't know since what revision, but i
Hi,
A user enters a date range (ie. 2 dates, '2008-04-01' and
'2008-04-03'), the problem is to determine how many open events exist
on each day in this interval.
Assume that the "events" table has a "start_date" and an "end_date".
One way to solve this problem, is to create an inline view in th