List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:May 11 1999 2:00pm
Subject:MySQL slows down with "IN ( big-list )"
View as plain text  
>>>>> "Ken" == Ken Carroll <kenc@stripped> writes:

Ken> Hi.
Ken> 	I have noticed that MySQL slows down considerably when using a
Ken> statement
Ken> as follows:
Ken> 	SELECT *
Ken> 	FROM T
Ken> 	WHERE T.x IN ( 1, 2, 3, 4, 5, 6 ....., 120)
Ken> Are these values stored as a list or as a hash?  If they are a
Ken> hash, is there some value I can change so that the default hash
Ken> size is increased?   If it's a list, I guess I'm stuffed. :-(

Hi!

MySQL uses a binary tree if all entries in the IN list are constants.

Did you try to use EXPLAIN on the above query?  Is T.x really indexed?

Regards,
Monty
Thread
MySQL slows down with "IN ( big-list )"Ken Carroll10 May
  • MySQL slows down with "IN ( big-list )"Michael Widenius11 May
Re: Packet is Larger than max_allowed_packet from server configurationMark Matthews8 Dec