I'm using Mysql 5.0.7 and I've noticed the following very strange
functionality, perhaps someone can shed some light on it for me.

2 Tables (Request and Inventory)

Request
  id (int),
  partNumber varchar(60)

Inventory
  id(int),
  MPN varchar(60),
  MPNClean varchar(60)

I have about 1500 request records, and 20,000 inventory records.

The following query takes over 1.5 minutes to execute.

select r.id from request r LEFT JOIN inventory i ON
(i.MPN=r.partNumber OR i.MPNClean=r.partNumber);
[~1.5 minutes to execute]

I have no Idea why it would take so long.  So I started playing around
with the joins, and noticed something.  If there is only one join
criteria, it returns quickly:

select r.id from request r LEFT JOIN inventory i ON (i.MPN=r.partNumber)
[~1 second to execute]

Similarly, an INNER join, regardless of the number of parameters, also
returns quickly

select r.id from request r INNER JOIN inventory i ON
(i.MPN=r.partNumber OR i.MPNClean=r.partNumber);
[~1 second to execute]

select r.id from request r INNER JOIN inventory i ON (i.MPN=r.partNumber);
[~1 second to execute]

If someone could enlighten me as to why this is happening, I'd really
appreciate it.

Thanks,
Scott.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to